This project is read-only.

Designer NullReferenceException

Topics: Developer Forum
May 26, 2013 at 10:04 AM

when I add Scintilla by code like this
ScintillaNET.Scintilla sci = new ScintillaNET.Scintilla();
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.

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

Please refer to the documentation for proper installation.

May 27, 2013 at 9:22 AM
Edited May 27, 2013 at 9: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.
May 28, 2013 at 5: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.