Posted 18 years ago
by Adam Dickinson
SyntaxEditor v3.1.203
I am getting a weird crash. We're using your Syntax Editor in our scripting IDE and I've implemented a Find/Replace in Files dialog box. On a Replace All (which runs in its own thread), words are replaced outside of the editor, and open files are reloaded to view the changes. Then, we refresh the intellisense for the file associated with the active tab, dynamically changing the Language specification to pick up changed syntax keywords.
The crash does not occur 100% of the time and has 3 incarnations. When the crash occurs, I can elect to Continue at which point I get a stack dump for where the exception occurred:
CASE 1:CASE 2:
CASE 3:
Unfortunately, I can't send you the code for our app as it is propriety, quite complex, and at the moment, I don't have time to strip it down to build a sample app to demo the bug. But I can tell you I've tracked it down to some consequence of my intellisense refreshing (which works fine under all other circumstances it is used).
Instead, does anyone know of situations in which the above exceptions might occur? Specifically, what is the correct procedure for reloading a file? What are the correct steps to dynamically add/remove LexicalPatternGroups to/from the document's Language? What about syntax color highlighting? When is the proper time to update that?
Thanks.
[Modified at 05/02/2006 05:59 PM]
I am getting a weird crash. We're using your Syntax Editor in our scripting IDE and I've implemented a Find/Replace in Files dialog box. On a Replace All (which runs in its own thread), words are replaced outside of the editor, and open files are reloaded to view the changes. Then, we refresh the intellisense for the file associated with the active tab, dynamically changing the Language specification to pick up changed syntax keywords.
The crash does not occur 100% of the time and has 3 incarnations. When the crash occurs, I can elect to Continue at which point I get a stack dump for where the exception occurred:
CASE 1:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.DocumentLineCollection.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.EditorView._2(Graphics , Rectangle )
at ActiproSoftware.SyntaxEditor.EditorView.OnRender(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIElement.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.OnRenderChildElements(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl._1(PaintEventArgs )
at ActiproSoftware.WinUICore.UIControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ragScriptEditor.Form1.Main(String[] args) in c:\soft\rage\script\tools\ragscripteditor\form1.cs:line 25An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll
Additional information: Cannot call Invoke or InvokeAsync on a control until the window handle has been created.
23
Unhandled Exception: System.InvalidOperationException: Cannot call Invoke or InvokeAsync on a control until the window handle has been created.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at ScriptComponent.FindReplaceAllForm.ReplaceDone(Int32 totalFound, Int32 matchingFiles, Int32 totalFilesSearched, EFindNextReturnTypes err, String errorString1, String errorString2) in c:\soft\rage\script\tools\ragscripteditor\ragcomponent\findreplaceallform.cs:line 1125
at WinSearchFile.FindReplace.ReplaceAllInClosedDoc(String fileName, FindReplaceOptions findReplaceOptions, Form theForm, AddFoundStringDelegate foundStringDel, String& errorString1, String& errorString2, SearchDoneDelegate searchDoneDel) in C:\soft\rage\script\tools\ragScriptEditor\ragComponent\FileSearch.cs:line 1202
at WinSearchFile.FindReplace.ClosedDocSearchReplace() in C:\soft\rage\scriptThe thread '<No Name>' (0x1110) has exited with code 0 (0x0).
\tools\ragScriptEditor\ragComponent\FileSearch.cs:line 774The program '[3160] ragScriptEditor.exe' has exited with code 0 (0x0).
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.DisplayLineCollection.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.EditorView._2(Graphics , Rectangle )
at ActiproSoftware.SyntaxEditor.EditorView.OnRender(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIElement.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.OnRenderChildElements(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl._1(PaintEventArgs )
at ActiproSoftware.WinUICore.UIControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ragScriptEditor.Form1.Main(String[] args) in c:\soft\rage\script\tools\ragscripteditor\form1.cs:line 2523The program '[2632] ragScriptEditor.exe' has exited with code 0 (0x0).
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at ActiproSoftware.SyntaxEditor.Token.get_Language()
at ActiproSoftware.SyntaxEditor.EditorView._1(Graphics , Rectangle , DocumentLine , Int32 , DisplayLine , _42 , Rectangle , Int32 )
at ActiproSoftware.SyntaxEditor.EditorView._2(Graphics , Rectangle )
at ActiproSoftware.SyntaxEditor.EditorView.OnRender(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIElement.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.OnRenderChildElements(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl._1(PaintEventArgs )
at ActiproSoftware.WinUICore.UIControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message&An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll
Additional information: Cannot call Invoke or InvokeAsync on a control until the window handle has been created.
m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ragScriptEditor.Form1.Main(String[] args) in c:\soft\rage\script\tools\ragscripteditor\form1.cs:line 2523
Unhandled Exception: System.InvalidOperationException: Cannot call Invoke or InvokeAsync on a control until the window handle has been created.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at ScriptComponent.FindReplaceAllForm.ReplaceDone(Int32 totalFound, Int32 matchingFiles, Int32 totalFilesSearched, EFindNextReturnTypes err, String errorString1, String errorString2) in c:\soft\rage\script\tools\ragscripteditor\ragcomponent\findreplaceallform.cs:line 1125
at WinSearchFile.FindReplace.ReplaceAllInClosedDoc(String fileName, FindReplaceOptions findReplaceOptions, Form theForm, AddFoundStringDelegate foundStringDel, String& errorString1, String& errorString2, SearchDoneDelegate searchDoneDel) in C:\soft\rage\script\tools\ragScriptEditor\ragComponent\FileSearch.cs:line 1202
at WinSearchFile.FindReplace.ClosedDocSearchReplace() in C:\soft\rage\scriptThe thread '<No Name>' (0x15a0) has exited with code 0 (0x0).
\tools\ragScriptEditor\ragComponent\FileSearch.cs:line 774The program '[3672] ragScriptEditor.exe' has exited with code 0 (0x0).
Instead, does anyone know of situations in which the above exceptions might occur? Specifically, what is the correct procedure for reloading a file? What are the correct steps to dynamically add/remove LexicalPatternGroups to/from the document's Language? What about syntax color highlighting? When is the proper time to update that?
Thanks.
[Modified at 05/02/2006 05:59 PM]