NullReferenceException on RadSpreadSheet

0 Answers 63 Views
Spreadsheet
Valentin
Top achievements
Rank 1
Iron
Iron
Valentin asked on 11 Oct 2023, 09:01 AM

Hello guys,

I'm using the RadSpreadsheet component since 3 months. I dont have any difficulties with it, except since this week I met a very strange behavior. In my context, the RadSpreadsheet is loaded from a csv file deserialization, some calculation are replaced by the numeric values and some cells are read to say if the results is good or not. I have a UserControl which contains only the RadSpreadsheet and RadFormulaBar components, with a dedicated ViewModel.

The fact is that sometimes, during the process, some NullReferenceException are thrown and the process is cut. The StackTrace provides big traces into the Telerik environment.

Example of piece of code generating the error:

        Private Sub SelectCell(cell As String)
            Dim columnNumber As Integer = 0
            Dim rowNumber As Integer = 0

            AerodynamicTableController.ConvertNumbersToExcelCoordinates(cell, columnNumber, rowNumber)

            Dim selection As Selection = Me.sprdSheet.ActiveWorksheetEditor.Selection
            selection.Select(New CellRange(rowNumber, columnNumber, rowNumber, columnNumber))
        End Sub

The StackTrace (the GetValueAsNonArrayConstantExpression method needs expression variable which is null):

at Telerik.Windows.Documents.Spreadsheet.Expressions.ExpressionExtensions.GetValueAsNonArrayConstantExpression(RadExpression expression, Boolean popupArrayErrors)
   at Telerik.Windows.Documents.Spreadsheet.Expressions.ExpressionExtensions.GetValueAsNonArrayConstantExpression(RadExpression expression, Boolean popupArrayErrors)
   at Telerik.Windows.Documents.Spreadsheet.Expressions.ExpressionExtensions.GetValueAsConstantExpression(RadExpression expression)
   at Telerik.Windows.Documents.Spreadsheet.Model.FormulaCellValue.GetResultValueAsCellValue()
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.CalculateCellProperties(List`1 cellIndexes)
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.UpdateCellContentSizesCache()
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.Measure()
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.Measure(CellIndex frozenCellIndex)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.NormalWorksheetEditorPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.RadWorksheetEditor.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Window.MeasureOverrideHelper(Size constraint)
   at System.Windows.Window.MeasureOverride(Size availableSize)
   at Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.WindowHostWindow.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   at MS.Internal.Documents.DocumentPageTextView.Validate()
   at MS.Internal.Documents.DocumentPageTextView.Validate(ITextPointer position)
   at MS.Internal.Documents.TextViewBase.System.Windows.Documents.ITextView.Validate(ITextPointer position)
   at System.Windows.Documents.TextPointer.GetLineStartPosition(Int32 count, Int32& actualCount)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.CellEditorBase.ScrollToCaret()
   at Telerik.Windows.Controls.Spreadsheet.Controls.RadSpreadsheetFormulaBar.SetFormulaBarTextBoxCaretToStart()
   at Telerik.Windows.Controls.Spreadsheet.Controls.RadSpreadsheetFormulaBar.UpdateFormulaBarTextFromSelectedCell()
   at Telerik.Windows.Controls.Spreadsheet.Controls.RadSpreadsheetFormulaBar.Selection_SelectionChanged(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.SelectionBase.OnSelectionChanged()
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.Selection.OnSelectionChanged()
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.SelectionBase.RaiseSelectionChanged()
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.SelectionBase.SelectInternal(CellIndex fromIndex, CellIndex toIndex, Boolean clearSelection)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.SelectionBase.Select(CellIndex fromIndex, CellIndex toIndex, Boolean clearSelection)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.SelectionBase.Select(CellRange cellRange, Boolean clearSelection)
   at Portal_View.Aerodynamic.SpreadSheetView.SelectCell(String cell) in C:\Users\ng707d2\Documents\aDEV\MAA\Sources\WPFPortal\Portal_View\Aerodynamic\Views\SpreadSheetView.xaml.vb:line 193

For this case, I have cheated using a Try Catch statement and the Thread.Sleep() method, andit seems that this piece of code "cancels" the issue:

            Try
                selection.Select(New CellRange(rowNumber, columnNumber, rowNumber, columnNumber))
            Catch ex As Exception
                Threading.Thread.Sleep(200)
                selection.Select(New CellRange(rowNumber, columnNumber, rowNumber, columnNumber))
            End Try

It's like if the RadSpreadsheet component isn't totally build before I'm using it.

But even using my cheat above, I have another NullReferenceException, but I don't know what's the error source because it's catched by my application CurrentDispatcherUnhandledException event:

   at Telerik.Windows.Documents.Spreadsheet.Expressions.ExpressionExtensions.GetValueAsNonArrayConstantExpression(RadExpression expression, Boolean popupArrayErrors)
   at Telerik.Windows.Documents.Spreadsheet.Expressions.ExpressionExtensions.GetValueAsNonArrayConstantExpression(RadExpression expression, Boolean popupArrayErrors)
   at Telerik.Windows.Documents.Spreadsheet.Expressions.ExpressionExtensions.GetValueAsConstantExpression(RadExpression expression)
   at Telerik.Windows.Documents.Spreadsheet.Model.FormulaCellValue.GetResultValueAsCellValue()
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.CalculateCellProperties(List`1 cellIndexes)
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.UpdateCellContentSizesCache()
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.Measure()
   at Telerik.Windows.Documents.Spreadsheet.Layout.RadWorksheetLayout.Measure(CellIndex frozenCellIndex)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.NormalWorksheetEditorPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.RadWorksheetEditor.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Window.MeasureOverrideHelper(Size constraint)
   at System.Windows.Window.MeasureOverride(Size availableSize)
   at Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.WindowHostWindow.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   at MS.Internal.Documents.DocumentPageTextView.Validate()
   at MS.Internal.Documents.DocumentPageTextView.Validate(ITextPointer position)
   at MS.Internal.Documents.TextViewBase.System.Windows.Documents.ITextView.Validate(ITextPointer position)
   at System.Windows.Documents.TextPointer.GetLineStartPosition(Int32 count, Int32& actualCount)
   at Telerik.Windows.Controls.Spreadsheet.Worksheets.CellEditorBase.ScrollToCaret()
   at Telerik.Windows.Controls.Spreadsheet.Controls.RadSpreadsheetFormulaBar.SetFormulaBarTextBoxCaretToStart()
   at Telerik.Windows.Controls.Spreadsheet.Controls.RadSpreadsheetFormulaBar.UpdateFormulaBarTextFromSelectedCell()
   at Telerik.Windows.Controls.Spreadsheet.Controls.RadSpreadsheetFormulaBar.<>c__DisplayClass9.<Cells_CellPropertyChanged>b__8()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

--

You can find below the csv file content used by the deserialization process:

;ZONE;ID;M;Altitude(ft);ISA(ºC);x(m);Flat Plate BL Method;do you know M1?;Cp;M1 Known;h(mm);Gap (mm);w(mm);a (º);r(mm);b (º);forward-rearward;Forward Chamfer;M1;d_fp(mm);Cf1_fp;Cf1_Known;Cf1_option;CD_Step;Sref(m^2);q1/qinf;md;CD(d.c.);;Title30;Title31;Title32;Title33;Title34;Title35;Title36;Title37;Title38;Title39;Title40
1;C1;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,124;0,85;{MF}[AL000_AB0001C_AL_0000_14A].F_Actual;{MF}[AL000_AB0001C_AL_0000_14A].G_Actual;24,8;16,7;0;19,8;RWD;0;0,91;109,8;0,001775;0,002289;Known;"{SF}=CD_STEP(E2;D2;F2;I2;J2;K2;W2;L2;R2;Q2;O2;S2;P2)";432,1;"{SF}=Q1_Q(E2;D2;F2;I2;J2;K2)";1;{SF}=Y2*L2*N2*AA2*1E-06*10000/Z2;{SF}=SUM(AC2:AC11);;;;0,4;-0,4
2;C1;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,124;0,85;{MF}[AL000_AB0001C_AL_0001_14A].F_Actual;{MF}[AL000_AB0001C_AL_0001_14A].G_Actual;24,8;16,7;0;19,7;RWD;0;0,91;109,8;0,001775;0,002307;Known;"{SF}=CD_STEP(E3;D3;F3;I3;J3;K3;W3;L3;R3;Q3;O3;S3;P3)";432,1;"{SF}=Q1_Q(E3;D3;F3;I3;J3;K3)";1;{SF}=Y3*L3*N3*AA3*1E-06*10000/Z3;;;;Kc_Min;0,001777;0,0015;{SF}=AVERAGE(AH3:AI3)
3;C1;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,123;0,85;{MF}[AL000_AB0001C_AL_0002_14A].F_Actual;{MF}[AL000_AB0001C_AL_0002_14A].G_Actual;24,8;16,7;0;19,6;RWD;0;0,91;109,8;0,001775;0,002327;Known;"{SF}=CD_STEP(E4;D4;F4;I4;J4;K4;W4;L4;R4;Q4;O4;S4;P4)";432,1;"{SF}=Q1_Q(E4;D4;F4;I4;J4;K4)";1;{SF}=Y4*L4*N4*AA4*1E-06*10000/Z4
4;C1;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,123;0,85;{MF}[AL000_AB0001C_AL_0003_14A].F_Actual;{MF}[AL000_AB0001C_AL_0003_14A].G_Actual;24,8;16,7;0;19,5;RWD;0;0,91;109,8;0,001775;0,00235;Known;"{SF}=CD_STEP(E5;D5;F5;I5;J5;K5;W5;L5;R5;Q5;O5;S5;P5)";432,1;"{SF}=Q1_Q(E5;D5;F5;I5;J5;K5)";1;{SF}=Y5*L5*N5*AA5*1E-06*10000/Z5
5;C1;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,122;0,85;{MF}[AL000_AB0001C_AL_0004_14A].F_Actual;{MF}[AL000_AB0001C_AL_0004_14A].G_Actual;24,8;16,7;0;19,4;RWD;0;0,91;109,8;0,001775;0,002368;Known;"{SF}=CD_STEP(E6;D6;F6;I6;J6;K6;W6;L6;R6;Q6;O6;S6;P6)";432,1;"{SF}=Q1_Q(E6;D6;F6;I6;J6;K6)";1;{SF}=Y6*L6*N6*AA6*1E-06*10000/Z6
6;C1;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,121;0,85;{MF}[AL000_AB0001C_AL_0005_14A].F_Actual;{MF}[AL000_AB0001C_AL_0005_14A].G_Actual;24,8;16,7;0;19,2;RWD;0;0,91;109,8;0,001776;0,002389;Known;"{SF}=CD_STEP(E7;D7;F7;I7;J7;K7;W7;L7;R7;Q7;O7;S7;P7)";432,1;"{SF}=Q1_Q(E7;D7;F7;I7;J7;K7)";1;{SF}=Y7*L7*N7*AA7*1E-06*10000/Z7
7;C2;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,12;0,85;{MF}[AL000_AB0001C_AL_0006_14A].F_Actual;{MF}[AL000_AB0001C_AL_0006_14A].G_Actual;24,8;2,86;0;19,1;RWD;0;0,91;109,8;0,001776;0,00241;Known;"{SF}=CD_STEP(E8;D8;F8;I8;J8;K8;W8;L8;R8;Q8;O8;S8;P8)";432,1;"{SF}=Q1_Q(E8;D8;F8;I8;J8;K8)";1;{SF}=Y8*L8*N8*AA8*1E-06*10000/Z8
8;C2;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,119;0,85;{MF}[AL000_AB0001C_AL_0007_14A].F_Actual;{MF}[AL000_AB0001C_AL_0007_14A].G_Actual;24,8;2,86;0;19;RWD;0;0,91;109,8;0,001776;0,002432;Known;"{SF}=CD_STEP(E9;D9;F9;I9;J9;K9;W9;L9;R9;Q9;O9;S9;P9)";432,1;"{SF}=Q1_Q(E9;D9;F9;I9;J9;K9)";1;{SF}=Y9*L9*N9*AA9*1E-06*10000/Z9
9;C2;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,117;0,85;{MF}[AL000_AB0001C_AL_0008_14A].F_Actual;{MF}[AL000_AB0001C_AL_0008_14A].G_Actual;24,8;2,86;0;18,9;RWD;0;0,91;109,8;0,001776;0,002455;Known;"{SF}=CD_STEP(E10;D10;F10;I10;J10;K10;W10;L10;R10;Q10;O10;S10;P10)";432,1;"{SF}=Q1_Q(E10;D10;F10;I10;J10;K10)";1;{SF}=Y10*L10*N10*AA10*1E-06*10000/Z10
10;C2;LER_1;0,85;35000;0;10;ESDU_00006;NO;-0,116;0,85;{MF}[AL000_AB0001C_AL_0009_14A].F_Actual;{MF}[AL000_AB0001C_AL_0009_14A].G_Actual;24,8;2,86;0;18,7;RWD;0;0,91;109,8;0,001777;0,00248;Known;"{SF}=CD_STEP(E11;D11;F11;I11;J11;K11;W11;L11;R11;Q11;O11;S11;P11)";432,1;"{SF}=Q1_Q(E11;D11;F11;I11;J11;K11)";1;{SF}=Y11*L11*N11*AA11*1E-06*10000/Z11

The {SF} flag is removed juste after the deserialization. 

The {MF} is replaced by a numeric value during the process.

--

I understand that this case is very strange and complicated to analyze, but do you have any information about these exceptions? I'm using the 2021.1.222.40 Telerik version. I can't really provide you a sample project because it is too big and too sensitive (business environment).

Many thanks.

Valentin M.

Dimitar
Telerik team
commented on 12 Oct 2023, 08:23 AM

Hi Valentin, 

Can you shat the code that calls this method and specify when you use it. Is the application loaded at this point? 

Thank you in advance for your patience and cooperation. 

Regards,

Dimitar

Valentin
Top achievements
Rank 1
Iron
Iron
commented on 18 Oct 2023, 03:55 PM

Hello Dimitar,

The code calling the selection.Select method is called when I want to manually apply a value in a cell:

        Private Sub ApplyFormulaResults(ByRef dicFormulas As Dictionary(Of String, MaaFormula))
            For Each cellFormula As KeyValuePair(Of String, MaaFormula) In dicFormulas
                If Not cellFormula.Value.CanBeCalculated.HasValue Then Continue For

                If cellFormula.Value.CanBeCalculated.HasValue Then
                    Me.SelectCell(cellFormula.Key)
                    Me.ApplyFormulaToSelectedCell(cellFormula.Value.TransformedFormula)

                    Dim selectedCell As CellSelection = Me.sprdSheet.ActiveWorksheetEditor.Selection.ActiveCell
                    Dim result As String = selectedCell.GetValue().Value.GetResultValueAsString(CellValueFormat.GeneralFormat)
                    Dim measuredValueDec As Decimal = 0

                    If Decimal.TryParse(result.Replace(",", "."), NumberStyles.Number, CultureInfo.InvariantCulture, measuredValueDec) Then
                        cellFormula.Value.Result = result
                        cellFormula.Value.CanBeCalculated = True
                    Else
                        'Error or not all variables available
                        cellFormula.Value.CanBeCalculated = False
                    End If
                End If
            Next
        End Sub

The application is loaded, the spreadsheet is visible and loaded using a Task and the results are calculated before set in the cells.

 

You can find below the ApplyFormulaToSelectedCell too:

        Private Sub ApplyFormulaToSelectedCell(formula As String)
            Dim selectedCell As CellSelection = Me.sprdSheet.ActiveWorksheetEditor.Selection.ActiveCell
            selectedCell.SetValue(formula)
        End Sub

 

I hope this help.

Thank you,

Valentin M.

Dimitar
Telerik team
commented on 19 Oct 2023, 12:34 PM

Hi Valentin,

Following the provided code I have created a sample project but the exception is not reproducible with it. Could you please check it and let me know what else I need to add in order to reproduce this? 

I am looking forward to your reply.

Valentin
Top achievements
Rank 1
Iron
Iron
commented on 19 Oct 2023, 04:16 PM

Hello Dimitar,

You can define a ViewModel based on GalaSoft to the sample project. You can add the following structure too, in order to be like my structure:

'In spreadsheet.xaml.vb file
AddHandler Me.ViewModel.OnApplyFormulaResults, AddressOfMe.ApplyFormulaResults

'The InitializeSpreadSheet method is called from a task function in the ViewModel
Private Async Function StartChecks() As Task
	Dim isAllProcessPerformed As Boolean = Await Me.RunSpreadSheetCalculations() 'This method calls the InitializeSpreadSheet method
End Function

'In my ViewModel too
Private Sub InitializeSpreadSheet()
	Singleton.Instance.InvokeIfRequired(Sub()
						Me.SpreadSheetViewModel = New SpreadSheetViewModel(False) 'Create the SpreadSheet VM to data contextualized the UserControl associated to
						Me.ComputeMaaFormulas() 'Call the "RaiseEvent OnApplyFormulaResults(cellFormulas)" code line
					    End Sub)
End Sub

'The method to call an action using the Dispatcher
Public Sub InvokeIfRequired(action As Action)
	If Windows.Application.Current?.Dispatcher?.CheckAccess = False Then
		Windows.Application.Current.Dispatcher.Invoke(Sub() action())
	Else
		action()
	End If
End Sub

I'm sorry I can't provide you a sample project because of my organization's restrictions.
I hope this help.

Is the provided StackTrace helpfull for you?

Thank you,

Valentin M.

Dimitar
Telerik team
commented on 23 Oct 2023, 07:29 AM

Hi Valentin, 

This information still does not allow me to reproduce this. I have examined the CallStack again but it does not give a clue what is wrong in this case. What can cause the exception is an invalid expression as well. Perhaps you can examine the parsed CSV file and see if there is a value that is not expected. 

I understand that you cannot send the entire project here in the forum. Please consider posting a support ticket which is a private thread and you can attach your project there. This way we ca reproduce this on our side and determine what is casing the issue.

Thank you for your understanding.

No answers yet. Maybe you can help?

Tags
Spreadsheet
Asked by
Valentin
Top achievements
Rank 1
Iron
Iron
Share this question
or