Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#59 .NET Framework Unhandled Exception with long path files


See attached file and the following error.

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.

After this, the application closes and nothing has been synced, and the settings are lost.

Here's the full log:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
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.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.Path.GetFullPathInternal(String path)
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.IO.FileSystemInfo.get_FullName()
at FTPbox.Forms.fMain.LoadLocalFolders()
at FTPbox.Forms.fMain.CheckPaths()
at FTPbox.Forms.fMain.StartUpWork()
at FTPbox.Forms.fMain.fMain_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
Assembly Version:
Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
Assembly Version:
Win32 Version:
CodeBase: file:///C:/Program%20Files/FTPbox/FTPbox.exe
Assembly Version:
Win32 Version: 4.0.30319.233 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
Assembly Version:
Win32 Version: 4.0.30319.269 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
Assembly Version:
Win32 Version: 4.0.30319.278 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
Assembly Version:
Win32 Version: 4.0.30319.282 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
Assembly Version:
Win32 Version: 4.0.30319.233 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
Assembly Version:
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
Assembly Version:
Win32 Version:
CodeBase: file:///C:/Program%20Files/FTPbox/Renci.SshNet.DLL
Assembly Version:
Win32 Version:
CodeBase: file:///C:/Program%20Files/FTPbox/Starksoft.Net.Ftp.DLL
Assembly Version:
Win32 Version:
CodeBase: file:///C:/Program%20Files/FTPbox/Starksoft.Net.Proxy.DLL

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging

For example:

<system.windows.forms jitDebugging="true" />

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.




  • JohnTheGr8

    Doing a quick Google search I found out that this is a Windows limitation.
    You can check under "Maximum Path Length Limitation" in the following link: http://msdn.microsoft.com/en-us/library/aa365247\(VS.85).aspx#maximum_path_length

    I will, however, take a look and see if I can find a workaround for this problem!

  • The workaround I did was manually. The initial 60 characters of my path are my backup folder and my userprofile (ie C:\Backup\LaptopName\Users\Username.Domainname\Documents). I substed that folder to my S-drive (subst S: FolderName) and then used the S-drive for the sync location instead...

  • Hi there, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam feedback? If so how do you reduce it, any plugin or anything you can suggest? I get so much lately it's driving me mad so any assistance is very much appreciated.
    Monster Beats http://www.shoppingbeatsbydrestudio.com/