Designer NullReferenceException

Topics: Developer Forum
May 26, 2013 at 9:04 AM
Hi,

when I add Scintilla by code like this
ScintillaNET.Scintilla sci = new ScintillaNET.Scintilla();
Controls.Add(sci);
it works fine. So I think, paths and framework are set-up correctly.

However, when I drag/drop the component from the toolbox the component shows a System.NullReferenceException in Designer with this callstack:
bei ScintillaNET.Scintilla.DirectMessage(Int32 msg, IntPtr wParam, IntPtr lParam) in C:\Users\jslusser\Projects\ScintillaNET\Releases\2.5\ScintillaNET\Scintilla.cs:Zeile 247.
bei ScintillaNET.Scintilla.paintRanges(Graphics g) in C:\Users\jslusser\Projects\ScintillaNET\Releases\2.5\ScintillaNET\Scintilla.cs:Zeile 1378.
bei ScintillaNET.Scintilla.OnPaint(PaintEventArgs e) in C:\Users\jslusser\Projects\ScintillaNET\Releases\2.5\ScintillaNET\Scintilla.cs:Zeile 1246.
bei ScintillaNET.Scintilla.WndProc(Message& m) in C:\Users\jslusser\Projects\ScintillaNET\Releases\2.5\ScintillaNET\Scintilla.cs:Zeile 2183.
Any idea what's wrong? Version is the recommended release of 2.5.2.

Regards
Coordinator
May 27, 2013 at 6:23 AM
There are quite a few discussions on this topic already....

Please refer to the documentation for proper installation.



Jacob
May 27, 2013 at 8:22 AM
Edited May 27, 2013 at 8:26 AM
Thank you for your reply.

jacobslusser wrote:
There are quite a few discussions on this topic already....
Well - all these seem not too related to the error I was facing.
Please refer to the documentation for proper installation.
As you could imagine, that was the first I read. I wrote "I think, paths and framework are set-up correctly."

Anyway - I've found the solution now. Some currently unknown installation package somewhen copied a version of Scilexer.dll which is apparently outdated to c:\windows. Since the user PATH is only appended to the system PATH, this old version was used. Maybe you want to add some note to better use the system PATH if possible (and prepend the Scinitilla.Net folder). Or check for outdated versions of the Dlls. I overwrote that DLL and it works now.
Coordinator
May 28, 2013 at 4:27 PM
That is a good point about older versions of SciLexer interfering. That was v1 (pre-COM days) of Microsoft's DLL Hell. It can be particularly insidious on 64 bit systems. If you are developing a 64 bit app you may not ever consider that the 32 bit version is getting picked up by the Visual Studio designer.