Skip to content

[Bug]: Previewer Process Crashes on rebuild/build #202

Closed

Description

@waliarubal

Describe the bug

04:06:04.795 [Error] [PreviewerProcessFactory] Shadow-copy preparation failed for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj'
System.IO.IOException: The process cannot access the file 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at te.anb(ShadowCopyRequest a, CancellationToken b)
   at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareShadowCopyAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AvaloniaUI.Previewer.Process.PreviewerProcessFactory.<CreateLaunchOptionsAsync>d__12.MoveNext()
04:06:04.795 [Information] [PreviewerProcess (#38307653)] Process exited: GenericError
Image

Previewer process crashes whenever I build or rebuild the project, its happening only with the recent release. Past release barely had this issue.

To Reproduce

For me just rebuilding the project crashes the previewer most of the time. I am running latest windows and Visual Studio.

Product(s)

Avalonia for Visual Studio

Platform

Windows

License Tier

Community

Avalonia version

12.1.3

Tool/Control Version

No response

Relevant log output

03:58:20.104 [Information] [AvaloniaPackage] Logging initialized.
03:58:20.107 [Information] [AvaloniaPackage] File logging disabled
03:58:20.116 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:20.130 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:20.131 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:20.132 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:20.369 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:20.371 [Information] [AvaloniaPackage] Avalonia context activated. User signed in: True
03:58:20.757 [Warning] [AxamlClassifier (#43620368)] Could not get classifications: source not yet loaded.
03:58:20.966 [Warning] [AxamlThicknessAdornmentTagger (#36463702)] Unable to obtain parsed XAML because the request returned null
03:58:20.966 [Warning] [AxamlColorAdornmentTagger (#60426628)] Unable to obtain parsed XAML because the request returned null
03:58:21.124 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:21.125 [Information] [AvaloniaEditorWithPreview (#32842235)] User is signed in
03:58:21.163 [Information] [CpsProjectInfoService] Evaluating project metadata via CPS for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj'
03:58:21.239 [Information] [PreviewerProcess (#11257801)] Starting previewer process for target E:\Workspace\Mehar\src\Mehar.Desktop\bin\Debug\net10.0\Mehar.Desktop.dll (ShadowCopy=False, NewHostApp=False)
03:58:21.243 [Information] [PreviewerProcess (#11257801)] [17844] Started previewer process for 'E:\Workspace\Mehar\src\Mehar.Desktop\bin\Debug\net10.0\Mehar.Desktop.dll'. Waiting for connection to be initialized.
03:58:21.355 [Information] [PreviewerProcess (#11257801)] [17844] Connection initialized
03:58:43.936 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:43.936 [Information] [AvaloniaEditorWithPreview (#3951742)] User is signed in
03:58:43.987 [Information] [CpsProjectInfoService] Evaluating project metadata via CPS for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj'
03:58:43.999 [Information] [PreviewerProcess (#52634865)] Starting previewer process for target E:\Workspace\Mehar\src\Mehar.Desktop\bin\Debug\net10.0\Mehar.Desktop.dll (ShadowCopy=False, NewHostApp=False)
03:58:43.999 [Information] [PreviewerProcess (#52634865)] [19572] Started previewer process for 'E:\Workspace\Mehar\src\Mehar.Desktop\bin\Debug\net10.0\Mehar.Desktop.dll'. Waiting for connection to be initialized.
03:58:44.062 [Information] [PreviewerProcess (#52634865)] [19572] Connection initialized
03:58:56.474 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:58:56.476 [Information] [AvaloniaEditorWithPreview (#26546824)] User is signed in
03:58:56.513 [Information] [CpsProjectInfoService] Evaluating project metadata via CPS for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj'
03:58:56.523 [Information] [PreviewerProcess (#25319268)] Starting previewer process for target E:\Workspace\Mehar\src\Mehar.Desktop\bin\Debug\net10.0\Mehar.Desktop.dll (ShadowCopy=False, NewHostApp=False)
03:58:56.523 [Information] [PreviewerProcess (#25319268)] [20992] Started previewer process for 'E:\Workspace\Mehar\src\Mehar.Desktop\bin\Debug\net10.0\Mehar.Desktop.dll'. Waiting for connection to be initialized.
03:58:56.587 [Information] [PreviewerProcess (#25319268)] [20992] Connection initialized
03:59:16.560 [Information] [PreviewerProcess (#25319268)] Stopping previewer process
03:59:16.562 [Information] [PreviewerProcess (#25319268)] Stopping previewer process
03:59:16.562 [Information] [PreviewerProcess (#25319268)] Process exited: GenericError
03:59:16.562 [Information] [PreviewerProcess (#25319268)] Stopping previewer process
03:59:16.584 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:59:16.584 [Information] [AvaloniaEditorWithPreview (#3951742)] User is signed in
03:59:17.555 [Information] [PreviewerProcess (#52634865)] Stopping previewer process
03:59:17.559 [Information] [PreviewerProcess (#52634865)] Stopping previewer process
03:59:17.559 [Information] [PreviewerProcess (#52634865)] Process exited: GenericError
03:59:17.559 [Information] [PreviewerProcess (#52634865)] Stopping previewer process
03:59:17.573 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
03:59:17.573 [Information] [AvaloniaEditorWithPreview (#32842235)] User is signed in
03:59:18.463 [Information] [PreviewerProcess (#11257801)] Stopping previewer process
03:59:18.479 [Information] [PreviewerProcess (#11257801)] Stopping previewer process
03:59:18.479 [Information] [PreviewerProcess (#11257801)] Process exited: GenericError
03:59:18.479 [Information] [PreviewerProcess (#11257801)] Stopping previewer process
04:01:22.377 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:01:38.986 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:01:38.987 [Information] [AvaloniaEditorWithPreview (#36570070)] User is signed in
04:01:39.701 [Information] [PreviewerProcessFactory] Resolving metadata for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj' (TFM=net10.0)
04:01:39.724 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.3, net10.0)
04:01:41.125 [Information] [ShadowCopyOutputStrategy] Shadow copy created at 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3' (8 files)
04:01:41.142 [Information] [PreviewerProcess (#56259124)] Starting previewer process for target C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll (ShadowCopy=True, NewHostApp=True)
04:01:41.146 [Information] [PreviewerProcess (#56259124)] [20628] Started previewer process for 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll'. Waiting for connection to be initialized.
04:01:41.269 [Information] [PreviewerProcess (#56259124)] [20628] Connection initialized
04:04:36.671 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:04:36.671 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:04:36.724 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:04:36.724 [Information] [AvaloniaEditorWithPreview (#9224559)] User is signed in
04:04:36.925 [Information] [PreviewerProcessFactory] Resolving metadata for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj' (TFM=net10.0)
04:04:36.931 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.3, net10.0)
04:04:36.941 [Information] [ShadowCopyOutputStrategy] Shadow copy reused at 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3' (8 files)
04:04:36.955 [Information] [PreviewerProcess (#38307653)] Starting previewer process for target C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll (ShadowCopy=True, NewHostApp=True)
04:04:36.957 [Information] [PreviewerProcess (#38307653)] [17076] Started previewer process for 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll'. Waiting for connection to be initialized.
04:04:37.036 [Information] [PreviewerProcess (#38307653)] [17076] Connection initialized
04:04:38.100 [Error] [PreviewerProcess (#38307653)] System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Window'.
   at Avalonia.Headless.HeadlessWindowExtensions.GetImpl(TopLevel topLevel)
   at Avalonia.Headless.HeadlessWindowExtensions.RunJobsOnImpl(TopLevel topLevel, Action`1 action)
   at Avalonia.Headless.HeadlessWindowExtensions.CaptureRenderedFrame(TopLevel topLevel)
   at i.i()
   at Avalonia.Threading.DispatcherOperation.InvokeCore()
04:05:52.831 [Error] [PreviewerProcess (#38307653)] System.ArgumentException: StaticResourceExtension.ResourceKey must be set.
   at Avalonia.Markup.Xaml.MarkupExtensions.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider, Object resourceKey)
   at Builder_4c78c44aac5347519cd5fab426e67058_avares___Mehar_Desktop_Fake_xaml.__AvaloniaXamlIlPopulate(IServiceProvider, IdentityView)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.<>c__DisplayClass16_0.<LoadOrPopulate>b__0(Object target)
   at Mehar.Desktop.Views.IdentityView.!XamlIlPopulateTrampoline(IdentityView)
   at Mehar.Desktop.Views.IdentityView.InitializeComponent(Boolean loadXaml) in E:\Workspace\Mehar\src\Mehar.Desktop\obj\Debug\net10.0\Avalonia.Generators\Avalonia.Generators.NameGenerator.AvaloniaNameIncrementalGenerator\Mehar.Desktop.Views.IdentityView.g.cs:line 24
   at Mehar.Desktop.Views.IdentityView..ctor() in E:\Workspace\Mehar\src\Mehar.Desktop\Views\IdentityView.axaml.cs:line 9
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
04:05:54.361 [Error] [PreviewerProcess (#38307653)] System.ArgumentException: StaticResourceExtension.ResourceKey must be set.
   at Avalonia.Markup.Xaml.MarkupExtensions.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider, Object resourceKey)
   at Builder_2688f04586dd4f11b506875d17efe5ac_avares___Mehar_Desktop_Fake_xaml.__AvaloniaXamlIlPopulate(IServiceProvider, IdentityView)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.<>c__DisplayClass16_0.<LoadOrPopulate>b__0(Object target)
   at Mehar.Desktop.Views.IdentityView.!XamlIlPopulateTrampoline(IdentityView)
   at Mehar.Desktop.Views.IdentityView.InitializeComponent(Boolean loadXaml) in E:\Workspace\Mehar\src\Mehar.Desktop\obj\Debug\net10.0\Avalonia.Generators\Avalonia.Generators.NameGenerator.AvaloniaNameIncrementalGenerator\Mehar.Desktop.Views.IdentityView.g.cs:line 24
   at Mehar.Desktop.Views.IdentityView..ctor() in E:\Workspace\Mehar\src\Mehar.Desktop\Views\IdentityView.axaml.cs:line 9
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
04:06:04.779 [Information] [PreviewerProcess (#38307653)] Stopping previewer process
04:06:04.779 [Information] [PreviewerProcessFactory] Resolving metadata for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj' (TFM=net10.0)
04:06:04.779 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.3, net10.0)
04:06:04.795 [Error] [PreviewerProcessFactory] Shadow-copy preparation failed for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj'
System.IO.IOException: The process cannot access the file 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at te.anb(ShadowCopyRequest a, CancellationToken b)
   at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareShadowCopyAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AvaloniaUI.Previewer.Process.PreviewerProcessFactory.<CreateLaunchOptionsAsync>d__12.MoveNext()
04:06:04.795 [Information] [PreviewerProcess (#38307653)] Process exited: GenericError
04:06:04.795 [Information] [PreviewerProcess (#38307653)] Stopping previewer process
04:10:20.509 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:10:20.509 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:10:20.533 [Information] [AuthenticationService] Restoring previous session: 10/02/2026 21:00:52 +00:00 / 10/12/2026 21:00:52 +00:00
04:10:20.533 [Information] [AvaloniaEditorWithPreview (#9224559)] User is signed in
04:10:20.533 [Information] [PreviewerProcessFactory] Resolving metadata for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj' (TFM=net10.0)
04:10:20.547 [Error] [PreviewerProcessFactory] Shadow-copy preparation failed for 'E:\Workspace\Mehar\src\Mehar.Desktop\Mehar.Desktop.csproj'
System.IO.IOException: The process cannot access the file 'C:\Users\walia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\Mehar.Desktop_jcYUsop-U699lPV3\Mehar.Desktop.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at te.anb(ShadowCopyRequest a, CancellationToken b)
   at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareShadowCopyAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AvaloniaUI.Previewer.Process.Output.ShadowCopyOutputStrategy.<PrepareAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AvaloniaUI.Previewer.Process.PreviewerProcessFactory.<CreateLaunchOptionsAsync>d__12.MoveNext()
04:10:20.533 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.3, net10.0)

Additional context

No response

Activity

  1. added theissue type on Oct 1, 2026
  2. assigned and unassigned on Oct 1, 2026
  3. maxkatz6 commented on Oct 1, 2026

    @maxkatz6
    Member

    @waliarubal can you confirm that this issue is reproducible when you have two or more VS tabs opened, while rebuilding project?

  4. waliarubal commented on Oct 2, 2026

    @waliarubal
    Author

    @maxkatz6 Yes, I opened two design/code widnows and rebuilt. Yes the issue exists. See screenshot below, let me know if you need more information.

    Image
  5. waliarubal commented on Oct 2, 2026

    @waliarubal
    Author

    @maxkatz6 I just noticed that the error was shown in the second open tab, the first tab showed the preview. Seems to me that apart from a tab, rest all other tabs show the issue.

  6. waliarubal commented on Oct 5, 2026

    @waliarubal
    Author

    @maxkatz6 @mrlacey Do you have an estimated date by when the fix for this issue will be shipped? Looking forward to your reply.

    Do let me know if you need any information from my end.

  7. mrlacey commented on Oct 6, 2026

    @mrlacey
    Contributor

    @waliarubal hopefully the fix for this will be in the release scheduled for next week.

  8. waliarubal commented on Oct 6, 2026

    @waliarubal
    Author

    Thanks a lot @mrlacey for confirming the release timeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions