I use ManagedUI and have an exception at the end of the installation process:
Check this topic also: http://stackoverflow.com/questions/7302045/callback-delegates-being-collected
Managed Debugging Assistant 'CallbackOnCollectedDelegate' has detected a problem in '...WpfSetup\bin\Release\WpfSetup.exe'.In WixSharp.Msi\MsiSession.cs I see this:
Additional information: A callback was made on a garbage collected delegate of type 'WixSharp.Msi!WindowsInstaller.MsiInstallUIHandler::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.
uiHandler = new MsiInstallUIHandler(OnExternalUI); //must be kept alive until the end of the MsiInstallProduct call
where OnExternalUI is a private function.Check this topic also: http://stackoverflow.com/questions/7302045/callback-delegates-being-collected
You are creating a delegate object here and passing it to the unmanaged code. Problem is, the garbage collector cannot track references held by native code. The next garbage collection will find no references to the object and collect it.Also it's working fine if I use Debug version of WixSharp.Msi (because of it's not optimized).