System.UnauthorizedAccessException while loading XAML Design view in VS 2019 ( Developer mode enabled )

Manikandan Venkataraman 1 Reputation point
2022-02-23T05:15:59.073+00:00

I recently moved to UWP development and facing issues with my first project. XAML design view is throwing a System.UnauthorizedAccessException in VS 2019. Developer mode is enabled, and its a corporate laptop. Attached the stack trace. Kindly help.

System.UnauthorizedAccessException
Access is denied.

Access is denied.

at Microsoft.VisualStudio.DesignTools.UwpDesignerHost.Utility.PackageDependencyHelper.EnsureDependencyRegistered(IAppPackageHelper appPackageHelper, HostPackageDependency packageDependency, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.UwpDesignerHost.Utility.PackageDependencyHelper.RegisterPackageDependency(IAppPackageHelper appPackageHelper, HostPackageDependency packageDependency, PackageManifestUpdater packageManifestUpdater, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.UwpDesignerHost.Utility.CoreRuntimeRegistrationHelper.EnsureCoreRuntimeRegistered(IAppPackageHelper appPackageHelper, PackageManifestUpdater packageManifestUpdater, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.UwpDesignerHost.ShadowCopy.AppxPlatformOnlyShadowCopyWorker.UpdateDependencies(CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.UwpDesignerHost.ShadowCopy.AppxPlatformOnlyShadowCopyWorker.<>c__DisplayClass6_0.<CopyProjectContentAsync>b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostPlatformBase.<EnsureProjectPayloadAsync>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.UwpDesignerHost.UwpHostPlatform.<EnsureProjectPayloadAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostPlatformBase.<EnsureShadowCacheContent>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostPlatformBase.<CreateSurfaceProcessAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.SurfaceDesigner.Documents.SurfaceIsolation.SurfaceProcessContext.<EnsureSurfaceProcessAsyncCore>d__107.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.SurfaceDesigner.Documents.SurfaceIsolation.SurfaceProcessContext.<EnsureSurfaceProcessAsyncInternal>d__105.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.DesignTools.XamlSurfaceDesigner.Views.IsolatedSurfaceImageHost.<CreateSurfaceAsync>d__66.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

System.AggregateException
One or more errors occurred.

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Manikandan Venkataraman 1 Reputation point
    2022-02-23T16:27:16.22+00:00

    I ran VS 2019 in Administrator mode and it resolved the Exception.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.