benhinman
Posts: 37
Joined: Wed Aug 06, 2008 7:50 am

.NET Custom Action exception handling

Hi,

I've been playing around with the exception handling in .NET custom action's running under Vista.

On XP/2003, throwing an exception in a .NET custom action results in both an error dialog and an entry in the event viewer detailing what the error was.

On Vista, this gets replaced with the unfriendly 2869 error.

Given that we have to throw an exception to induce a rollback, is there anyway of showing the error short of catching all exceptions, displaying a message box and finally rethrowing?

I only ask, because on XP this will result in the same dialog twice, and on Vista you will still see the 2869 error.

Thanks for any suggestions,
Ben
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: .NET Custom Action exception handling

Hi Ben,

Unfortunately this is not supported for the .NET Installer Class Action. A workaround would be to catch the exception inside the custom action and if the install is running on Vista show a message box.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
benhinman
Posts: 37
Joined: Wed Aug 06, 2008 7:50 am

Re: .NET Custom Action exception handling

So is this actually a Windows Installer bug and are Microsoft putting any effort into resolving it?

It seems 2869 is a catch-all for everything they forgot to handle!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: .NET Custom Action exception handling

Hi,

No, this isn't a bug and most likely Microsoft is not going to improve the behavior. The possible causes of the 2869 error are explained in this FAQ. Basically, there are some limitations for .NET Installer Class Actions in Windows Installer.

The behavior you want can be achieved by using a C++ DLL custom action. This is the custom action type recommended by Microsoft.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”