cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SimonG
Level 5

DotNetCoCreateObject crashes IS when used in OnFirstUIBefore

InstallScript project.
InstallShield 2012.

When using DotNetCoCreateObject and calling a method on the dll the InstallShield setup crashes (even exception handling won't stop it from crashing) but ONLY when I do it in OnFirstUIBefore. The exact same call works fine if done later in the process (e.g. in a feature installing handler). It is as if there is something that gets initialised by InstallShield after OnFirstUIBefore is called that allows DotNetCoCreateObject to work after that.

try
set myObj = DotNetCoCreateObject("D:\\Wibble.dll", "Mycompany.Wibble.MyWibbleClass, "Mycompany.Wibble");
myObj.MyTest(); // CRASHES HERE!

set myObj = NOTHING;
DotNetUnloadAppDomain("Mycompany.Wibble");
catch
MessageBox("Oh poop", INFORMATION);
endcatch;


Any ideas why it crashes when you call MyTest in OnFirstUIBefore but not after that?!
Labels (1)
0 Kudos
(3) Replies
SimonG
Level 5

The same happens with MSI InstallScript projects too.

What can be done to fix it? Is there a secret initialisation function I can call to get calls to .NET Dlls to work in OnFirstUIBefore?
0 Kudos
SimonG
Level 5

Just discovered that there is the same issue in OnFirstUIAfter too, so the only time you can call methods in a Dot Net dll is in the Feature Installing Handlers.
0 Kudos
SimonG
Level 5

I've discovered what the problem is...

The methods I was trying to call were static and Com does not support this. Obviously InstallShields handling of this should be better (as InstallShield simply crashes without a trace, not even an error and no exception handling will hold onto the error).

Now I have another issue with using strings (adding '/0' a lot to all string variables), but at least I can work around that one, see this post...
http://community.flexerasoftware.com/showthread.php?174945-(Bug-)-Passing-string-variable-to-NET-function
0 Kudos