desjarlais / Scintilla.NET

A Windows Forms control, wrapper, and bindings for the Scintilla text editor.
MIT License
107 stars 25 forks source link

NullPointerException when running from SingleFile executable #63

Closed jas88 closed 1 year ago

jas88 commented 1 year ago

https://github.com/VPKSoft/Scintilla.NET/blob/2e458d140067a9167e3c30e3c8e7a9ab0a9cb163/Shared/Scintilla.cs#L48 - this assumes GetExecutingAssembly().Location is not null, which isn't always true. Using 'AppDomain.CurrentDomain.BaseDirectory' instead (or as a fallback if attached to the existing approach for other cases?) would avoid this.

VPKSoft commented 1 year ago

Hi, Thanks for pointing this out - has this null reference exception happened to you?

jas88 commented 1 year ago

Yes - I'm just updating an application which uses Scintilla to use your package, and hit this as soon as I load the compiled .exe. As a temporary workaround I've used a LibHarmony patch to replace the whole LocateNativeDllDirectory method as above.

VPKSoft commented 1 year ago

Okay, then it is more urgent - I'll try to find the time to fix this in the coming weekend 👍

VPKSoft commented 1 year ago

This should be fixed now.