I'm having a problem debugging some code that uses the SyntaxEditor. The issue is that after closing the MDI form that holds a SyntaxEditor control, I get a ObjectDisposedException.
Here's the exception:The problem is that during the MDI window close, the code goes through and calls the Dispose() method on all of the controls. Later after the window is closed the above exception is thrown. I have verified that the code that closes the window is called, and the exception isn't thrown from that code. It appears to be thrown from a thread separate from my main code.
I have done a few things to narrow down the issue:
I commented out the call to Dispose() on my MDI form and the exception is no longer thrown.
I have tried to set the reference to the syntax editor to null after disposing so that I would get a null reference exception instead of the object disposed exception, but that didn't change anything, I still get the object disposed exception.
The stack trace leads me to believe that the OnSemanticParseDataChanged event handler is getting called on a non-existant SyntaxEditor control, however, I never turned on that event, nor do I know where I should turn that event handler off.
Or maybe I'm completely wrong what this error is. I am sure, however, that the offending code is being called from a thread that did not create nor have control over.
Any Ideas?
Mike
Here's the exception:
System.ObjectDisposedException was unhandled
Message="Cannot access a disposed object.\r\nObject name: 'CSharpEditor'."
Source="System.Windows.Forms"
ObjectName="CSharpEditor"
StackTrace:
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 ActiproSoftware.SyntaxEditor.SyntaxEditor.k(Object A_0, EventArgs A_1)
at ActiproSoftware.SyntaxEditor.Document.OnSemanticParseDataChanged(EventArgs e)
at ActiproSoftware.SyntaxEditor.Document.a(ISemanticParseData A_0, TextRange A_1, Boolean A_2)
at ActiproSoftware.SyntaxEditor.Document.ActiproSoftware.SyntaxEditor.ISemanticParseDataTarget.NotifySemanticParseComplete(SemanticParserServiceRequest request)
at ActiproSoftware.SyntaxEditor.SemanticParserService.a(SemanticParserServiceRequest A_0)
at ActiproSoftware.SyntaxEditor.SemanticParserService.c()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I have done a few things to narrow down the issue:
I commented out the call to Dispose() on my MDI form and the exception is no longer thrown.
I have tried to set the reference to the syntax editor to null after disposing so that I would get a null reference exception instead of the object disposed exception, but that didn't change anything, I still get the object disposed exception.
The stack trace leads me to believe that the OnSemanticParseDataChanged event handler is getting called on a non-existant SyntaxEditor control, however, I never turned on that event, nor do I know where I should turn that event handler off.
Or maybe I'm completely wrong what this error is. I am sure, however, that the offending code is being called from a thread that did not create nor have control over.
Any Ideas?
Mike