I have a Windows Forms application that has a ClickOnce update check in Program.cs and an immediateAsyncUpdate / Application.Restart(). Periodically, the restarted application fails on startup with the following error:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Deployment.Internal.Isolation.IActContext.SetApplicationRunningState(UInt32 dwFlags, UInt32 ulState, UInt32& ulDisposition)
at System.ActivationContext.SetApplicationState(ApplicationState s)
at System.AppDomain.SetupDomainForApplication(ActivationContext activationContext, String[] activationData)
at System.AppDomain.SetupApplicationHelper(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, ApplicationIdentity appIdentity, ActivationContext activationContext, String[] activationData)
at System.AppDomain.SetDomainManager(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr parentSecurityDescriptor, Boolean publishAppDomain)
at System.AppDomain.SetDefaultDomainManager(String fullName, String[] manifestPaths, String[] activationData)
Subsequently starting the application from the start menu succeeds.
This problem seem to only occur on some machines and not on others even though these machines are similarily configured. We've tried delayed restarts, shutting down antivirus and clearing the clickonce cache with mage to no avail.
Thanks.