dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
735 stars 1.57k forks source link

system.io.pathtoolongexception article doesn't mention that longpathaware manifest is required, or that the long path gpo must be set #10099

Open Squall-Leonhart opened 4 months ago

Squall-Leonhart commented 4 months ago

Going by the Blog post here, https://learn.microsoft.com/en-us/archive/blogs/jeremykuhne/net-4-6-2-and-long-paths-on-windows-10, it is inferred you need to meet all 3 criteria

Dotnet 4.6.2 or later Target (and not overriding the behavior with AppContextSwitchOverrides) NTFS Long Path GPO or Corresponding Registry set <longPathAware xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> in the app.manifest

But this is missing on https://learn.microsoft.com/en-us/dotnet/api/system.io.pathtoolongexception?view=net-8.0

adamsitnik commented 4 months ago

cc @JeremyKuhne

JeremyKuhne commented 4 months ago

Yeah, it would probably help to link some of these things together. The Path class also has some details that link to a bigger article based on my posts.

The following Windows doc pages should be linked in:

.NET does implicit \\?\ for you so you don't need to do any of these steps. You also don't need the OS configuration to use \\?\ long paths on .NET Framework 4.6.2 or later.

There is one important caveat for .NET Framework: No matter what you do, you can never run apps or load assemblies from long paths on .NET Framework. .NET Framework native runtime code has fixed MAX_PATH buffers for paths.