0

I am trying to save a file:

Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog
        {
            FileName = "verylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexampleverylongexample.foo",
            DefaultExt = ".foo",
            Filter = "Foo Bar|*.foo"
        };

Upon pressing Save in the dialog, I receive this:

The filename, directory name, or volume label syntax is incorrect.

even though I have this in my app.manifest:

<application xmlns="urn:schemas-microsoft-com:asm.v3">
  <windowsSettings xmlns:ws2="https://schemas.microsoft.com/SMI/2016/WindowsSettings">
      <ws2:longPathAware>
          true
      </ws2:longPathAware>
</windowsSettings>

as mentioned here: https://learn.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation

naglas
  • 462
  • 1
  • 6
  • 16

1 Answers1

-1

So yes, what guys mentioned in the comments means that your Windows doesn't support it.

Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions.

Now, to make it cross-Windows, you'd have to create custom file dialog, operating through paths using \\?\Drive:\ style.

Mike Makarov
  • 1,287
  • 8
  • 17