locked
Visual Studio 2012 Designer crashes with System.IO.PathTooLongException RRS feed

  • Question

  • Hi, I'm a student from Denmark trying to write my first WinRT app with Visual Studio 2012 Ultimate (Dreamspark license).
    I've encountered this error several times now, seemingly for no apparent reason. It's like it happens at random.

    I enter the designer to edit my MainPage.xaml and the designer crashes with the following:

    System.IO.PathTooLongException
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
       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)
    
    System.IO.PathTooLongException
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
    
    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.IO.PathTooLongException
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
       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.LocalHostShadowCopyTask.Microsoft.Expression.DesignHost.IHostShadowCopyTask.BeginShadowCopyTask(IHostProject hostProject)
       at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.InitializeProjectShadowCache(IHostProject project)
       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.IO.PathTooLongException
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
    
    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.RemoteHostShadowCopyTask.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteHostShadowCopyTask.BeginShadowCopyTask(IRemoteHostProject hostProject)
       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.IRemoteHostShadowCopyTask.BeginShadowCopyTask(IRemoteHostProject hostProject)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalHostShadowCopyTask.<>c__DisplayClass1.<Microsoft.Expression.DesignHost.IHostShadowCopyTask.BeginShadowCopyTask>b__0(IRemoteHostShadowCopyTask v)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass4`2.<MarshalOut>b__3()
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
    
    System.IO.PathTooLongException
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
       at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
       at System.IO.Path.GetDirectoryName(String path)
       at Microsoft.Expression.Utility.IO.PathHelper.GetDirectory(String path)
       at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyProvider.CopyFile(String sourcePath, String destinationPath, Boolean watchFile)
       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.HostUtility.ShadowCopy.HostShadowCopyService.PerformCachedShadowCopy(IHostShadowCopyProvider provider, ShadowCopySource source)
       at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyTask.RealizeShadowCopySource(IEnumerable`1 sources)
       at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyTask.BeginShadowCopyTask(IHostProject hostProject, Boolean includeReferences)
       at Microsoft.Expression.HostUtility.ShadowCopy.HostShadowCopyTask.BeginShadowCopyTask(IHostProject hostProject)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteHostShadowCopyTask.<>c__DisplayClass1.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteHostShadowCopyTask.BeginShadowCopyTask>b__0()
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15()
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

    Which is odd since my project is based in "D:\C#\MavinMusicPlayer" and should therefore not have any paths above the 260 character limit. I've searched the web to the best of my abilities but haven't been able to finde the answer.
    I should note that the code compiles and the program runs just fine. And even if I revert the changes I've made to the code before the crash, it will still crash afterwards.
    I do not know weather it matters, but none of my references have 260+ letter paths either. So I really don't understand where it's coming from.

    Please help!

    Kaspar Kjeldsen


    • Edited by Kaspar Kjeldsen Friday, November 23, 2012 3:00 PM forgot something
    Friday, November 23, 2012 2:58 PM

Answers

  • Hi Kasper,

                 Thanks for reporting this issue. The XAML designer uses a different directory on your machine (C:\Users\<UserName>\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache\) to store the files required to boot up the design process for your project. You might have some assets whose paths when appended to the above location exceeds the 260 character limit.


    Dev@Mic



    Tuesday, November 27, 2012 6:26 PM

All replies

  • Hi Kasper,

                 Thanks for reporting this issue. The XAML designer uses a different directory on your machine (C:\Users\<UserName>\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache\) to store the files required to boot up the design process for your project. You might have some assets whose paths when appended to the above location exceeds the 260 character limit.


    Dev@Mic



    Tuesday, November 27, 2012 6:26 PM
  • I just came across the same issue - I installed the Bing Maps SDK, and changed the platform to x86, and now all of my designer windows are broken with the System.IO.PathTooLongException error. Undoing the change does not fix the error, and deleting the shadow cache doesn't fix the error either. Is there anything else that can be done to get the designer back? I don't believe I have any assets that are of extraordinary length names.

    Thanks,

    Thomas

    Wednesday, December 19, 2012 3:13 AM
  • Hey Thomas,

    Is this issue specific to your project or repros with a new XAML Blank application as well? Please get in touch with me at navits at microsoft dot com and I can take a look.

    -Navit Saxena

    Wednesday, December 19, 2012 7:00 PM
  • Thanks for the reply Navit - this happened specific to my project - I was actually able to roll back the project on TFS, and when I re-added the Bing Maps SDK, I no longer get the problem now. If it occurs again, I'll be sure to get in touch, thanks!

    Thanks,

    Thomas

    • Proposed as answer by IQ.zero Sunday, July 27, 2014 8:38 AM
    • Unproposed as answer by IQ.zero Sunday, July 27, 2014 8:38 AM
    Friday, December 21, 2012 4:05 AM
  • Hi Kaspar,

    Try deleting your Temp files. This worked for me.

    Thanks,
    Abhijith
    Wednesday, March 19, 2014 6:16 AM