You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: VS previewer fails to start when the build output has long file paths #208
The previewer won't start when the project's build output contains a file with a long path. The error happens while the extension copies the build output into its own folder (%LOCALAPPDATA%\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer...), before the preview runs.
That folder's path is longer than bin\Debug\net10.0, so a file whose path is fine in bin can go over 260 characters once copied, and then the copy fails:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\<user>\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\PieChartTest_ZA0bRhZj8U80lAh4\Test\Folder with a loooooooooooooooong name\Nested folder with an even loooooooooooooooooooooooooooooooooooooooooonger name\File with a looooooooooooooooooooooooong name.txt'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareShadowCopyAsync>d__10.MoveNext()
at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareAsync>d__7.MoveNext()
at AvaloniaUI.Previewer.Process.PreviewerProcessFactory.<CreateLaunchOptionsAsync>d__12.MoveNext()
Long paths are enabled in Windows, but that doesn't seem to help, possibly because Visual Studio does not support that setting.
Interestingly, if the file's path is already over 260 characters in bin, the extension only logs a warning (Shadow copy source not found), skips the file, and the previewer starts fine. It only fails completely when the path is OK in bin but too long in the previewer's folder.
To Reproduce
Create a new Avalonia app.
Add a text file at a nested path, for example Test\Folder with a loooooooooooooooong name\Nested folder with an even loooooooooooooooooooooooooooooooooooooooooonger name\File with a looooooooooooooooooooooooong name.txt, with CopyToOutputDirectory="PreserveNewest". Its full path in bin should be under 260 characters, but over 260 once it's in the previewer's folder.
Activity
maxkatz6 commentedon Oct 12, 2026
@lmejiauxd thank you. We identified the issue.