This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- DotNetCoCreateObject crashes IS when used in OnFirstUIBefore
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 08, 2014
08:19 AM
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.
Any ideas why it crashes when you call MyTest in OnFirstUIBefore but not after that?!
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?!
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 09, 2014
03:20 AM
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?
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?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 09, 2014
04:51 AM
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 10, 2014
04:11 AM
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
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
