5

我遇到了这个奇怪的错误:拒绝访问路径“C:\Users...\Documents\My Music”。这发生在 XAML 设计器中。

老实说,我觉得这完全不专业,因为我确信我不是唯一一个得到这个的人,这是自从我开始使用 XAML 以来第二次出现这个问题。

第一次发生这种情况时,我将我的项目从 myDocuments 移到了 C:\ 驱动器。这清除了它。

但现在它又回来了。

我怎样才能永久摆脱这个问题,为什么会这样?

为了澄清起见,我不想从这个目录加载资源。XAML 设计者似乎自己来遍历 myMusic。

为什么会这样做?

堆栈跟踪:

Access to the path 'C:\Users\...\Documents\My Music' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
   at System.IO.FileSystemEnumerableIterator`1.MoveNext()
   at Microsoft.Expression.Utility.IO.PathHelper.<ResolveWildcard>d__0.MoveNext()
   at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyProvider.CacheFiles(String sourceDirectory, String targetDirectory, IEnumerable`1 paths, Boolean watchFiles)
   at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyProvider.CacheFiles(String sourceDirectory, String targetDirectory, IEnumerable`1 paths, Boolean watchFiles)
   at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyProvider.ShadowCopyFiles(String[] sourcePaths, String sourceRoot, String destinationRoot, Boolean watchFiles)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteHostShadowCopyProvider.<>c__DisplayClass1.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteHostShadowCopyProvider.ShadowCopyFiles>b__0()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.UnauthorizedAccessException
Access to the path 'C:\Users\Michael\Documents\My Music' is denied.

Server stack trace: 
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func`1 func)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteHostShadowCopyProvider.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteHostShadowCopyProvider.ShadowCopyFiles(String[] sourcePaths, String sourceRoot, String destinationRoot, Boolean watchFiles)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteHostShadowCopyProvider.ShadowCopyFiles(String[] sourcePaths, String sourceRoot, String destinationRoot, Boolean watchFiles)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalHostShadowCopyProvider.<>c__DisplayClass2.<Microsoft.Expression.DesignHost.IHostShadowCopyProvider.ShadowCopyFiles>b__0(IRemoteHostShadowCopyProvider s)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass4`2.<MarshalOut>b__3()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.UnauthorizedAccessException
Access to the path 'C:\Users\Michael\Documents\My Music' is denied.
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CallSynchronizationMode syncMode, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CallSynchronizationMode syncMode)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle`1 targetObject, Func`2 func, CallSynchronizationMode syncMode)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalHostShadowCopyProvider.Microsoft.Expression.DesignHost.IHostShadowCopyProvider.ShadowCopyFiles(String[] sourcePaths, String sourceRoot, String destinationRoot, Boolean watchFiles)
   at Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.CreateClassicShadowCopy(String assemblyPath, String projectPath)
   at Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.ResolveShadowCopyAssembly(String assemblyPath, String projectPath)
   at Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.ResolveAssembly(String assemblyPath, String assemblyFullName, String projectPath)
   at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(String path, String assemblyFullName)
   at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(HostReferenceData reference)
   at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.UpdateAssemblyReferences(IEnumerable`1 referencesToUpdate)
   at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver..ctor(IHostProject project, DesignerContext designerContext)
   at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyService.<.ctor>b__0(IHostProject project)
   at Microsoft.Expression.Utility.Collections.SuspendableKeyedCollection`2.CreateItems(TKey key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Expression.Utility.Collections.SuspendableKeyedCollection`2.GetItem(TKey key)
   at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(IHostProject project)
   at Microsoft.Expression.DesignSurface.Project.ProjectContextBase.Initialize()
   at Microsoft.Expression.DesignSurface.Project.XamlProjectContext.Initialize()
   at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
   at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem)
   at Microsoft.Expression.DesignSurface.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass10.<>c__DisplayClass12.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__f(CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.CallWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass10.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__e()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.UnauthorizedAccessException
Access to the path 'C:\Users\...\Documents\My Music' is denied.

Server stack trace: 
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func`1 func)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken remoteToken)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass8.<CreateDesignerImpl>b__6(IRemoteDesignerService d)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass4`2.<MarshalOut>b__3()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.UnauthorizedAccessException
Access to the path 'C:\Users\Michael\Documents\My Music' is denied.
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CallSynchronizationMode syncMode, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CallSynchronizationMode syncMode)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle`1 targetObject, Func`2 func, CallSynchronizationMode syncMode)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass12.<Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner>b__11(RemoteCancellationToken remoteToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.CallWithCancellation[TResult](CancellationToken cancelToken, Func`2 func)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
4

1 回答 1

4

找到解决方案: http ://readmystuff.wordpress.com/2013/08/08/wpf-access-to-the-path-cusersmichaeldocumentsmy-music-is-denied/

哦,谢谢你的反对票!

于 2013-08-08T19:57:52.630 回答