Posted 18 years ago by Thomas Goff
Avatar
I am getting an unhandled exception in SyntaxEditor (v3.1.0211). The stack track I get is:

System.NullReferenceException: Object reference not set to an instance of an object.
at ActiproSoftware.SyntaxEditor.SyntaxEditor.a(EditorView A_0, Keys A_1, Char A_2, Boolean A_3)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.OnKeyDown(KeyEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(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.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.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.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MyApplication.MainForm.Main(String[] args) in C:\MyApplication\MainForm.cs:line 665

Any ideas?

Comments (4)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Haven't seen that one. Can you give detailed steps on how to reproduce it in the sample project?


Actipro Software Support

Posted 18 years ago by Thomas Goff
Avatar
I wish I could ;-)

I think that the MDI child, that holds the editor, is being closed in the KeyTyping event. I also set the e.Cancel to true. Basically, if I detect a new version of the underlying file when the user started editing then I want to load that before allowing the user to edit. So in the case I unload the old version and load a new one. And the detection of a new file is done in KeyTyping.

I'll post more info as I find it.
Posted 18 years ago by Thomas Goff
Avatar
Ok, the problem with this was that I was reloading the file inside the DocumentTextChanging event. I wanted to know when the user performs any action that modify the text (drag/drop, cut/copy/paste, typeing, etc), so I could see if a newer version of the file was available in a remote location.

So when I changed the Document.Text property, I guess that was screwing up some internal data in your control. I changed the code to set the document to read-only, and use BeginInvoke to queue the reload so it would execute after (and outside) the DocumentTextChanging event.
Posted 18 years ago by Jared Phelps
Avatar
I had the same exception being thrown when manually setting the Document's text property, although for me it was because I forgot to add a default lexical state to my SyntaxLanguage. Just thought I'dd mention it here in case other noobies run into it as well.

Thanks!
Jared
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.