tesseract icon indicating copy to clipboard operation
tesseract copied to clipboard

Add null check for executing assembly path

Open Blightbuster opened this issue 3 years ago • 1 comments

When compiling a .NET6 project in release mode with the PublishSingleFile option, the following code throws because Assembly.GetExecutingAssembly().Location => null (MS Docs).

https://github.com/charlesw/tesseract/blob/9b256cc03d7c9260311e9d90656146dd620e8e9a/src/Tesseract/Internal/InteropDotNet/LibraryLoader.cs#L77-L82

Blightbuster avatar Jan 20 '22 12:01 Blightbuster

The root issue is GetExecutingAssembly I think; replace it with a call to something like typeof(TesseractEngine).Assembly still works

jas88 avatar Jul 21 '22 21:07 jas88

I've applied a workaround to our own Tesseract usage here - bit of a hack but seems to do the job for now, including compensating for dlopen having moved libraries on some recent Linux releases. https://github.com/SMI/IsIdentifiable/blob/main/IsIdentifiable/TesseractLinuxLoaderFix.cs

jas88 avatar Nov 11 '22 22:11 jas88

The previous fix 637342e has now been merged into master and was included in 5.2 release. Sorry for the delay!

charlesw avatar Nov 30 '22 09:11 charlesw