Thanks for the extensive explanation.
Yes I could probably handle the remaining case with a even shorter path, while unfortunately current project does not really allow for me to move things around or rename.
My thinking of the documentation page is to under the "to long path" header have something like: "You might see things like: `System.IO.DirectoryNotFoundException: Could not find a part of the path`"
The reason for me being adamant about having the exception in the documentation is for one to actually see it and connect the two, because even if I read the page several times, i didn't connect this to the path length.
And the other is so that it has a better chance of showing up when posting that exception and stack to your favorite internet search engine.
As for the exception; When this message is shown
Code:
The file 'C:\dev\projpath\obj\Debug\netstandard2.0\projname.GlobalUsings.g.cs' could not be written to the workspace due to error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\MyUser\AppData\Local\NCrunch\46876\35\projpartialpath\obj\Debug\netstandard2.0\projname.GlobalUsings.g.cs'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at nCrunch.Common.IO.FilePath.<>c__DisplayClass39_0.<WriteContent>b__0()
Catch System.IO.DirectoryNotFoundException, and extend the message with "The path length is x, expect issues at or below 260", this makes it easier to check for maximum path length.
Maybe what I propose below has already been tested?, if it does work, the above might be void ;)
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled REG_DWORD is now enabled by default...
Manifest is needed to enable use of this(?):
https://learn.microsoft....re-long-path-capability
Code:
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPathsEnabled=true" />
</runtime>
</configuration>
https://learn.microsoft....long-paths-on-windows-10