cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reureu
Level 10

Bug: try catch endcatch in InstallScript and Basic MSI projects behave differently

Hi,

I have been working on 2 different projects.

  • ProjectA is InstallScript.
  • ProjectB is Basic MSI.


I have noticed that try catch endcatch in the InstallScript project is unable to catch unhandled exception in the COM object's method.

function DoIt()
OBJECT comObject;
STRING errMsg;
begin
set comObject = CoCreateObject("MyProgID");
if (!IsObject(comObject)) then
errMsg = "comObject could not be created";
MessageBox(errMsg, SEVERE);
else
try
comObject.DoSomething();
catch
errMsg = "comObject.DoSomething(): exception thrown";
MessageBox(errMsg, SEVERE);
endcatch;
endif;
set comObject = NOTHING;
end;


The same code in a Basic MSI project (called from an InstallScript custom action scheduled for Deferred Execution) allows to catch the exception.


  • Is this different behaviour expected? Or is it a bug? :eek:
  • Is there any workaround? 😄
  • I have tried both IS 2010 and 2011 and faced exactly the same problem.


Regards
Labels (1)
0 Kudos
(3) Replies
Reureu
Level 10

Does any InstallShield developper have an idea about this issue?

I do think that being unable to catch exceptions thrown by COM objects in InstallScript project is a serious issue.

Regards
0 Kudos
Reureu
Level 10

Hi,

I forgot to mention that this issue makes setup.exe crash when a COM object throws an exception that the InstallScript engine is not able to catch.
(see attachment).

So, does anyone have an idea about a solution?

Regards
JY
0 Kudos
Reureu
Level 10

Problem solved! See here.
0 Kudos