SaveFileDialog does not handle longpath format
Targeting core 3.1 on windows 10
Setting a Microsoft.Win32.SaveFileDialog.InitialDirectory = "\?\C:\" results in the error:
System.ArgumentException: Value does not fall within the expected range.
at at MS.Internal.Interop.HRESULT.ThrowIfFailed()
at at MS.Internal.AppModel.ShellUtil.GetShellItemForPath(String path)
at at Microsoft.Win32.FileDialog.PrepareVistaDialog(IFileDialog dialog)
at at Microsoft.Win32.FileDialog.RunVistaDialog(IntPtr hwndOwner)
at at Microsoft.Win32.FileDialog.RunDialog(IntPtr hwndOwner)
at at Microsoft.Win32.CommonDialog.ShowDialog()
This is a legitimate path according to the documentation https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#short-vs-long-names
Pasting it in explorer works, Directory.Exists("\?\C:\") returns true.
saveFileDialog.CheckPathExists returns false after this is set.
I understand if this is a compatibility issue and it cant work because this is a win32 library, but as far as I understand there is no new version of SaveFileDialog that can be substituted to work around this in WPF.
Is there some trick I can use to deal with this? I could manually parse the path and remove the \?\ prefix but then if the path really is long it would (probably?) still crash.