Bug SS-4655
1 vote

Unhandled exception: Index out of bounds on pressing Delete key in math region

Created by Jostikas on 12/3/2020 12:34 PM Last Updated by Aertyom Shegeda on 12/23/2020 12:56 AM
%
 (hrs)
Logged: 0   (hrs)

 Description

Haven't yet found the exact reproduction steps, but the common thing seems to be trying to delete an operand along with the operator from a math region.
 

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at SMath.Controls.MathPainter.PrepareForPaint(MathRegion region, PaintContext ctx, Term[] input, MathAnswer answer, Term[] units, Boolean inputDataVisibility, Int32 currentTermIdx, FontInfo font, Boolean focused, Single& middleLine)
   at SMath.Controls.MathRegion.Prepare(IGraphics g, PaintEventOptions e)
   at SMath.Controls.MathRegion.PrePainter()
   at SMath.Controls.MathRegion.OnCommandSend(String value)
   at SMath.Controls.WorksheetEditor.InsertInsideRegion(RegionBase region, String value)
   at SMath.Controls.WorksheetEditor.InsertManager(String value)
   at SMath.Controls.Worksheet.Insert(String value)
   at SMath.Controls.WorksheetEditor.KeyDown(KeyEventOptions e)
   at SMath.UI.DesktopWorksheet.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 
followed by others when trying to continue.
 
************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
SMathStudio_Desktop
    Assembly Version: 0.99.7610.506
    Win32 Version: 0.99.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMathStudio_Desktop.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4200.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SMath.Manager
    Assembly Version: 0.99.7610.506
    Win32 Version: 0.99.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.Manager.DLL
----------------------------------------
SMath.Environment
    Assembly Version: 0.99.7610.506
    Win32 Version: 0.99.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.Environment.DLL
----------------------------------------
SMath.Drawing
    Assembly Version: 0.99.7610.506
    Win32 Version: 0.99.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.Drawing.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
SMath.Controls
    Assembly Version: 0.99.7610.506
    Win32 Version: 0.99.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.Controls.DLL
----------------------------------------
SMath.Math.Symbolic
    Assembly Version: 1.35.7610.506
    Win32 Version: 1.35.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.Math.Symbolic.DLL
----------------------------------------
SMath.Math.Numeric
    Assembly Version: 1.67.7610.506
    Win32 Version: 1.67.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.Math.Numeric.DLL
----------------------------------------
SpecialFunctions
    Assembly Version: 1.12.7610.506
    Win32 Version: 1.12.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/SpecialFunctions.dll
----------------------------------------
HyperlinkRegion
    Assembly Version: 1.0.7602.37852
    Win32 Version: 1.0.7602.37852
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/4938d1a8-ad11-4de8-afbf-d76d069cfbf8/1.0.7602.37852/HyperlinkRegion.dll
----------------------------------------
ElectricalEngineeringLibrary
    Assembly Version: 0.3.7200.18123
    Win32 Version: 0.3.7200.18123
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/3fd1f9ba-53ee-4665-966b-bd2805a84485/0.3.7200.18123/ElectricalEngineeringLibrary.dll
----------------------------------------
CurrencyUnits
    Assembly Version: 1.1.6871.3570
    Win32 Version: 1.1.6871.3570
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/5dbac4cd-5f31-4a17-982e-f3233b0546de/1.1.6871.3570/CurrencyUnits.dll
----------------------------------------
StatisticalTools
    Assembly Version: 1.0.6824.32561
    Win32 Version: 1.0.6824.32561
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/76f6e9f5-ac86-4ffb-9e4d-284c8daecaf9/1.0.6824.32561/StatisticalTools.dll
----------------------------------------
DataExchange
    Assembly Version: 1.1.7564.23373
    Win32 Version: 1.1.7564.23373
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/5dce7298-9e5f-4120-9a2e-49b16daa02a3/1.1.7564.23373/DataExchange.dll
----------------------------------------
CFLabelRegion
    Assembly Version: 1.0.7593.3985
    Win32 Version: 1.0.7593.3985
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/a43ac8f9-29d7-4e8a-9ad0-82cf7c4e14f6/1.0.7593.3985/CFLabelRegion.dll
----------------------------------------
HTMLFileType
    Assembly Version: 1.14.7610.506
    Win32 Version: 1.14.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/HTMLFileType.dll
----------------------------------------
XYPlotRegion
    Assembly Version: 0.2.7630.25147
    Win32 Version: 0.2.7630.25147
    CodeBase: file:///C:/Users/laurjo/AppData/Roaming/SMath/extensions/plugins/c12231ec-4873-43c1-a7d0-a167ebd17066/0.2.7630.25147/XYPlotRegion.dll
----------------------------------------
ImageFileType
    Assembly Version: 1.11.7610.506
    Win32 Version: 1.11.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/ImageFileType.dll
----------------------------------------
PictureRegion
    Assembly Version: 1.10.7610.506
    Win32 Version: 1.10.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/PictureRegion.dll
----------------------------------------
System.Design
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Design/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
PlotRegion
    Assembly Version: 1.11.7610.506
    Win32 Version: 1.11.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/PlotRegion.dll
----------------------------------------
SMathFileType
    Assembly Version: 1.11.7610.506
    Win32 Version: 1.11.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/SMathFileType.dll
----------------------------------------
StandardToolboxButtons
    Assembly Version: 1.1.7610.506
    Win32 Version: 1.1.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/StandardToolboxButtons.dll
----------------------------------------
TextRegion
    Assembly Version: 1.11.7610.506
    Win32 Version: 1.11.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/TextRegion.dll
----------------------------------------
ViewerFileType
    Assembly Version: 1.1.7610.506
    Win32 Version: 1.1.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/ViewerFileType.dll
----------------------------------------
XMCDFileType
    Assembly Version: 1.12.7610.506
    Win32 Version: 1.12.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/plugins/XMCDFileType.dll
----------------------------------------
SMath.UI
    Assembly Version: 0.99.7610.506
    Win32 Version: 0.99.7610.506
    CodeBase: file:///C:/Program%20Files%20(x86)/SMath%20Studio/SMath.UI.DLL
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

 

    Jostikas (Thursday, December 3, 2020 12:49 PM) #

Attached MWE. Seems like something to do with units?
Slightly different exception, but is also triggered on DEL, so hopefully same root cause:

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at SMath.Controls.MathEditor.ComplexLogic(Term eiPlacer, Int32[] watch, Int32[] sel, Boolean l2r)
   at SMath.Controls.MathEditor.InsManPart1(SessionProfile sessionProfile, String& value, Term eiPlacer, Int32[] watch, Int32[] sel, ChangeType& stateChanged, Int32& showSuggestions)
   at SMath.Controls.MathEditor.InsertManager(SessionProfile sessionProfile, String value, Int32[] watch, Int32[] sel, ChangeType& stateChanged, Int32& showSuggestions)
   at SMath.Controls.MathEditor.Insert(SessionProfile sessionProfile, String value, Int32[] watch, Int32[] sel, ChangeType& stateChanged, Int32& showSuggestions)
   at SMath.Controls.MathRegion.OnCommandSend(String value)
   at SMath.Controls.WorksheetEditor.InsertInsideRegion(RegionBase region, String value)
   at SMath.Controls.WorksheetEditor.InsertManager(String value)
   at SMath.Controls.Worksheet.Insert(String value)
   at SMath.Controls.WorksheetEditor.KeyDown(KeyEventOptions e)
   at SMath.UI.DesktopWorksheet.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)