For our project, we are using Advanced Installer 16.5 to generate installation exe from AIP file. We are also using same AIP file to generate patch. Install, Uninstall and Patch runs under Admin privileges.
In AIP, we have written a custom action, which does some registry clean-up. I have attached the screenshot of configuration of same custom action. (Image1). I have also attached the c# code for same custom action. (Image2)
Issue is, same custom action is running successfully while installing, uninstalling and in upgrade scenarios. But it is throwing below error while installing Patch:
Begin RegistryCleanUp
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at CustomActions.RegistryCleanUp(Session session)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction RegistryCleanup.CA.dll returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Any pointer to fix this issue?