I have a WPF application that uses a third-party library to perform a specific task; this library, in one of its methods, executes the statement Assembly.GetEntryAssembly()
.
If I run the WPF application on debug (by running a .Net exe for testing) the library works properly and Assembly.GetEntryAssembly()
returns a reference to the assembly of the executable, but in production I have a different situation that causes me some problems.
In production, the WPF application is integrated with a VB6 application and programs are launched from a VB6 menu using the InteropFormLibrary
; in this situation the library raise an exception because Assembly.GetEntryAssembly()
returns null
(it can't find the executable associated with the assembly).
My problem is that I can't change the code of the library because I don't have the sources available and I found the statement that throws the exception by dll
decompiler and analyzing the method that was in the exception.
Now my question is: Is there any way to make sure that the method GetEntryAssembly
doesn't return null
? Can I assign or "circumvent" in some way?