NullReferenceException in VisualStudio2005SyntaxEditorRender

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by Adam Dickinson
Version: 4.0.0257
Platform: Services
Environment: Windows XP (32-bit)
Avatar
I haven't been to repro this bug that one of my users reported, but I think it's important to post it nonetheless.

We use something other than your UIStudio to handle our dockable windows. Our SyntaxEditor controls are placed on a TabbedDocument to look just like Visual Studio. When someone right-clicks a TabbedDocument's tab, a context menu appears wtih "New Tab", "Close Tab", "Close Other Tabs", and "Close All Tabs" options.

My user had 2 documents open and when he tried to close the one that was not in focus, this happened:

System.NullReferenceException: Object reference not set to an instance of an object.
at ActiproSoftware.SyntaxEditor.VisualStudio2005SyntaxEditorRenderer.MeasureLineNumberMarginWidth(Graphics g, SyntaxEditor syntaxEditor)
at ActiproSoftware.SyntaxEditor.EditorView.MeasureCore(Graphics g, Size availableSize)
at ActiproSoftware.WinUICore.UIElement.Measure(Graphics g, Size availableSize)
at ActiproSoftware.WinUICore.UIControl.MeasureCore(Graphics g, Size availableSize)
at ActiproSoftware.WinUICore.UIControl.Measure(Graphics g, Size availableSize)
at ActiproSoftware.WinUICore.UIControl.UpdateLayout()
at ActiproSoftware.WinUICore.UIControl.Invalidate(InvalidationLevels levels, InvalidationTypes types)
at ActiproSoftware.WinUICore.UIControl.OnLayout(LayoutEventArgs e)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.PerformLayout()
at System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
at System.Windows.Forms.Layout.LayoutTransaction.Dispose()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at ActiproSoftware.SyntaxEditor.EditorView.Dispose(Boolean disposing)
at ActiproSoftware.ComponentModel.DisposableObject.a(Boolean A_0)
at ActiproSoftware.ComponentModel.DisposableObject.Dispose()
at ActiproSoftware.SyntaxEditor.SyntaxEditor.c(a8 A_0)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at ragScriptEditorShared.ScriptEditor.CloseFile(SyntaxEditor editor)
at ragScriptEditorShared.ScriptEditor.dockControl_Closing(Object sender, DockControlClosingEventArgs e)
at TD.SandDock.DockControl.OnClosing(DockControlClosingEventArgs e)
at TD.SandDock.DockControl.A(Boolean )
at TD.SandDock.DockControl.Close()
at ragScriptEditor.Form1.closeTabToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Right-clicking the tab for the document that is not in focus, brings it into focus (and hides the other document). A quick succession of visibility changes could contribute to the problem, I imagine. It goes something like this:

1) With Doc A in focus, the user right-clicks Doc B
2) Doc A is hidden
3) Doc B is made visible
4) Doc B is closed
5) Doc A is made visible

I'm not sure where in those 5 steps the exception ocurred, probably step 3 or 5. If I can get specifics from my user, I will let you know.

EDIT: My user said the crash ocured somewhere between step 3 and 4, perhaps on 4. Doc B's tab had not yet been removed, at least visually.

Thanks!

[Modified at 10/26/2007 07:41 PM]

Comments (2)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Adam,

We've updated the code in the offending procedure to look for additional nulls. This will be in the next maintenance release. If you'd like to try a preview of the next build to see if these changes fix it, send over an email. Thanks.


Actipro Software Support

Posted 11 years ago by Adam Dickinson
Avatar
No rush. We'll wait for the next maintenance release. Thanks!
The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.