Skip to content

[Bug]: Previewer Stopped #214

Closed
Closed

Description

@bonimy

Describe the bug

This is coming from a fresh install and a default MVVM project build

To Reproduce

Install Avalonia Community for Visual Studio Community, create a new MVVM project (.net9.0 for me, but I also tried 10 and 8), build it, and open MainWindow.axaml

Product(s)

Avalonia for Visual Studio

Platform

Windows

License Tier

Community

Avalonia version

12.3.2.0

Tool/Control Version

No response

Relevant log output

19:45:45.289 [Information] [AvaloniaPackage] Logging initialized.
19:45:45.295 [Information] [AvaloniaPackage] File logging enabled. Log file: C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Logs\VS_2026-10-12.log
19:45:45.302 [Information] [AuthenticationService] Restoring previous session: 10/16/2026 18:38:39 +00:00 / 10/26/2026 18:38:39 +00:00
19:45:45.307 [Debug] [AuthenticationService] Ticket was found from the subscription key.
19:45:45.315 [Information] [AuthenticationService] Restoring previous session: 10/16/2026 18:38:39 +00:00 / 10/26/2026 18:38:39 +00:00
19:45:45.316 [Debug] [AuthenticationService] Ticket was found from the subscription key.
19:45:45.316 [Information] [AuthenticationService] Restoring previous session: 10/16/2026 18:38:39 +00:00 / 10/26/2026 18:38:39 +00:00
19:45:45.317 [Debug] [AuthenticationService] Ticket was found from the subscription key.
19:45:45.317 [Information] [AuthenticationService] Restoring previous session: 10/16/2026 18:38:39 +00:00 / 10/26/2026 18:38:39 +00:00
19:45:45.318 [Debug] [AuthenticationService] Ticket was found from the subscription key.
19:45:45.320 [Debug] [AvaloniaToolboxService] Toolbox: advised selection events (cookie=19)
19:45:45.321 [Debug] [AvaloniaToolboxService] Captured existing toolbox frame at initialization
19:45:45.321 [Debug] [AvaloniaToolboxService] Toolbox visibility tracker initialized: frame captured=True, frame events cookie=4
19:45:45.322 [Debug] [AvaloniaPackage] Toolbox feature enabled; AvaloniaToolboxService constructed.
19:45:45.328 [Debug] [ParcelToolService] Checking for AvaloniaUI.Parcel tool availability
19:45:45.543 [Debug] [ParcelToolService] Parcel tool check completed. Available: False
19:45:45.546 [Debug] [OpenWithParcelCommand] Parcel tool availability: False
19:45:45.654 [Debug] [DebuggerEventsService] DebuggerEventsService initialized successfully
19:45:45.654 [Debug] [AvaloniaPackage] DebuggerEventsService initialized
19:45:45.655 [Debug] [AvaloniaPackage] OutputErrorsClearTriggerService initialized
19:45:45.658 [Debug] [AvaloniaPackage] Avalonia Package initialized
19:45:45.663 [Information] [AuthenticationService] Restoring previous session: 10/16/2026 18:38:39 +00:00 / 10/26/2026 18:38:39 +00:00
19:45:45.664 [Debug] [AuthenticationService] Ticket was found from the subscription key.
19:45:45.664 [Information] [AvaloniaPackage] Avalonia context activated. User signed in: True
19:45:46.235 [Warning] [AxamlClassifier (#3959276)] Could not get classifications: source not yet loaded.
19:45:46.289 [Debug] [AvaloniaToolboxViewCreationListener] AXAML view created; scheduling toolbox refresh.
19:45:46.292 [Debug] [AvaloniaToolboxService] Toolbox refresh requested (buffer True)
19:45:46.293 [Debug] [AvaloniaToolboxService] Toolbox refresh: license gate not satisfied; clearing any installed tabs
19:45:46.470 [Debug] [CpsProjectInfoService] Resolving target dependent projects via CPS for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj'
19:45:46.485 [Debug] [AvaloniaToolboxService] Toolbox refresh requested (buffer True)
19:45:46.485 [Debug] [AvaloniaToolboxService] Toolbox refresh: license gate not satisfied; clearing any installed tabs
19:45:46.486 [Debug] [AvaloniaToolboxService] Toolbox refresh requested (buffer True)
19:45:46.486 [Debug] [AvaloniaToolboxService] Toolbox refresh: license gate not satisfied; clearing any installed tabs
19:45:46.498 [Debug] [AvaloniaToolboxService] Toolbox visibility check: frame.IsVisible() → True
19:45:46.596 [Debug] [AvaloniaToolboxService] Toolbox refresh requested (buffer True)
19:45:46.596 [Debug] [AvaloniaToolboxService] Toolbox refresh: license gate not satisfied; clearing any installed tabs
19:45:46.601 [Debug] [AvaloniaToolboxService] Toolbox refresh requested (buffer True)
19:45:46.601 [Debug] [AvaloniaToolboxService] Toolbox refresh: license gate not satisfied; clearing any installed tabs
19:45:46.659 [Warning] [AxamlThicknessAdornmentTagger (#5052426)] Unable to obtain parsed XAML because the request returned null
19:45:46.659 [Warning] [AxamlColorAdornmentTagger (#42925716)] Unable to obtain parsed XAML because the request returned null
19:45:46.678 [Debug] [CpsProjectInfoService] Finished resolving dependent projects for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj'. Found 0 dependent projects.
19:45:46.859 [Information] [AuthenticationService] Restoring previous session: 10/16/2026 18:38:39 +00:00 / 10/26/2026 18:38:39 +00:00
19:45:46.860 [Debug] [AuthenticationService] Ticket was found from the subscription key.
19:45:46.860 [Information] [AvaloniaEditorWithPreview (#67029240)] User is signed in
19:45:46.912 [Information] [PreviewerProcessFactory] Resolving metadata for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj' (TFM=net9.0)
19:45:46.921 [Debug] [CpsAssetsPreviewerMetadataService] Resolving previewer metadata for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj' [net9.0]
19:45:45.658 [Debug] [AvaloniaPackage] Avalonia Package Loaded.
19:45:46.929 [Debug] [CpsAssetsPreviewerMetadataService] Resolving dependencies from 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\bin\Debug\net9.0\AvaloniaApplication2.deps.json'.
19:45:46.937 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.2, net9.0)
19:45:47.348 [Information] [ShadowCopyOutputStrategy] Shadow copy reused at 'C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe' (4 files)
19:45:47.464 [Debug] [PreviewerProcess (#48527177)] > C:\Program Files\dotnet\dotnet.exe exec --runtimeconfig "C:\Users\Nelson Garcia\source\AvaloniaApplication2\bin\Debug\net9.0\AvaloniaApplication2.runtimeconfig.json" --depsfile "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.previewer.deps.json" --additionalprobingpath "C:\Users\Nelson Garcia\.nuget\packages" --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages"  "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaUI.Previewer.HostApp.dll" --transport tcp-bson://127.0.0.1:51690/ "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll"
19:45:47.464 [Information] [PreviewerProcess (#48527177)] Starting previewer process for target C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll (ShadowCopy=True, NewHostApp=True)
19:45:47.468 [Information] [PreviewerProcess (#48527177)] [8072] Started previewer process for 'C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll'. Waiting for connection to be initialized.
19:45:47.762 [Debug] [PreviewerProcess (#48527177)] [8072] Sending message: AvaloniaUI.Previewer.Protocol.UpdateXamlMessage
19:45:47.315 [Warning] [CpsAssetsPreviewerMetadataService] Failed to resolve force-include packages
AvaloniaUI.BuildTools.Utilities.DotNetRunnerException: MSBUILD : error MSB1001: Unknown switch.
   at AvaloniaUI.BuildTools.Utilities.DotNetRunnerResult.ThrowIfError()
   at AvaloniaUI.BuildTools.MSBuild.MSBuildProjectTools.<GetProjectMetadata>d__5.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.Utilities.PreviewerForceIncludeResolver.<ResolveCoreAsync>d__5.MoveNext()
19:45:47.340 [Debug] [CpsAssetsPreviewerMetadataService] Resolve complete: 4 build outputs, 32 managed, 3 native, fingerprint=YSkwTXvdkAHNOCkp3daX+OfaF+FmyiZUC7POy3sm2UI=
19:45:47.735 [Error] [PreviewerProcess (#48527177)] [8072] <= Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Avalonia.Headless, Version=12.0.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'. The system cannot find the file specified.
19:45:47.735 [Debug] [PreviewerProcess (#48527177)] [8072] <= Preparing transport
19:45:47.735 [Debug] [PreviewerProcess (#48527177)] [8072] <= Preparing Window Manager
19:45:47.735 [Debug] [PreviewerProcess (#48527177)] [8072] <= Initializing application in design mode
19:45:47.735 [Debug] [PreviewerProcess (#48527177)] [8072] <= Loading entry assembly
19:45:47.735 [Debug] [PreviewerProcess (#48527177)] [8072] <= Obtaining AppBuilder instance from AvaloniaApplication2
19:45:47.741 [Information] [PreviewerProcess (#48527177)] [8072] Connection initialized
19:45:47.747 [Debug] [PreviewerProcess (#48527177)] [8072] Sending message: AvaloniaUI.Previewer.Protocol.ClientSupportedPixelFormatsMessage
19:45:48.018 [Error] [PreviewerProcess (#48527177)] [8072] <= File name: 'Avalonia.Headless, Version=12.0.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'
19:45:48.018 [Error] [PreviewerProcess (#48527177)] [8072] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.<StartAvaloniaApplication>g__WithHeadless|4_1(AppBuilder appBuilder)
19:45:48.018 [Error] [PreviewerProcess (#48527177)] [8072] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.c(CommandLineArgs a)
19:45:48.019 [Error] [PreviewerProcess (#48527177)] [8072] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.a(String[] a)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.Main(String[] cmdline)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at System.Reflection.MethodInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at System.Reflection.MethodInvoker.InvokeDirectByRef(Object obj, Object arg1, Object arg2, Object arg3, Object arg4)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at System.Reflection.MethodInvoker.InvokeImpl(Object obj, Object arg1, Object arg2, Object arg3, Object arg4)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at System.Reflection.MethodInvoker.Invoke(Object obj, Span`1 arguments)
19:45:48.020 [Error] [PreviewerProcess (#48527177)] [8072] <=    at Program.<Main>$(String[] args)
19:45:48.060 [Debug] [PreviewerProcess (#48527177)] [8072] Sending message: AvaloniaUI.Previewer.Protocol.UpdateXamlMessage
19:45:48.190 [Warning] [XamlClassificationSource (#61444888)] Parsed XAML was null during classification.
19:45:48.266 [Debug] [PreviewerProcess (#48527177)] [8072] Sending message: AvaloniaUI.Previewer.Protocol.UpdateXamlMessage
19:45:48.267 [Warning] [AxamlThicknessAdornmentTagger (#5052426)] Unable to obtain parsed XAML because the request returned null
19:45:48.267 [Warning] [AxamlColorAdornmentTagger (#42925716)] Unable to obtain parsed XAML because the request returned null
19:45:48.788 [Error] [PreviewerProcess (#48527177)] Connection error
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AvaloniaUI.Previewer.Protocol.BsonStreamTransportConnection.<ReadExact>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AvaloniaUI.Previewer.Protocol.BsonStreamTransportConnection.<Reader>d__16.MoveNext()
19:45:48.790 [Information] [PreviewerProcess (#48527177)] Process exited: GenericError
19:45:48.792 [Information] [PreviewerProcess (#48527177)] Stopping previewer process
19:45:50.474 [Error] [AvaloniaPreviewer (#48527177)] Error gating previewer XAML send on diagnostics
System.InvalidOperationException: Process not finished initializing.
   at AvaloniaUI.Previewer.Process.PreviewerProcess.<UpdateXamlAsync>d__62.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.VisualStudio.Extension.Views.AvaloniaPreviewer.<GateAndSendXamlAsync>d__103.MoveNext()
19:45:50.475 [Error] [AvaloniaPreviewer (#48527177)] Error gating previewer XAML send on diagnostics
System.InvalidOperationException: Process not finished initializing.
   at AvaloniaUI.Previewer.Process.PreviewerProcess.<UpdateXamlAsync>d__62.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.VisualStudio.Extension.Views.AvaloniaPreviewer.<GateAndSendXamlAsync>d__103.MoveNext()
19:46:06.587 [Debug] [EditorPane (#22776773)] Build started
19:46:08.289 [Debug] [EditorPane (#22776773)] Build finished
19:46:08.289 [Information] [PreviewerProcessFactory] Resolving metadata for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj' (TFM=net9.0)
19:46:08.289 [Debug] [CpsAssetsPreviewerMetadataService] Resolving previewer metadata for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj' [net9.0]
19:46:08.289 [Debug] [CpsAssetsPreviewerMetadataService] Resolving dependencies from 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\bin\Debug\net9.0\AvaloniaApplication2.deps.json'.
19:46:08.293 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.2, net9.0)
19:46:08.297 [Debug] [CpsAssetsPreviewerMetadataService] Resolve complete: 4 build outputs, 32 managed, 3 native, fingerprint=BwBQevK+7k6bM8jk8P0XPcMvpfRHD8EXIcVBsJGLJ80=
19:46:08.335 [Information] [ShadowCopyOutputStrategy] Shadow copy created at 'C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe' (4 files)
19:46:08.349 [Debug] [PreviewerProcess (#48527177)] > C:\Program Files\dotnet\dotnet.exe exec --runtimeconfig "C:\Users\Nelson Garcia\source\AvaloniaApplication2\bin\Debug\net9.0\AvaloniaApplication2.runtimeconfig.json" --depsfile "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.previewer.deps.json" --additionalprobingpath "C:\Users\Nelson Garcia\.nuget\packages" --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages"  "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaUI.Previewer.HostApp.dll" --transport tcp-bson://127.0.0.1:51708/ "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll"
19:46:08.349 [Information] [PreviewerProcess (#48527177)] Starting previewer process for target C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll (ShadowCopy=True, NewHostApp=True)
19:46:08.356 [Information] [PreviewerProcess (#48527177)] [5708] Started previewer process for 'C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll'. Waiting for connection to be initialized.
19:46:08.461 [Debug] [PreviewerProcess (#48527177)] [5708] <= Preparing transport
19:46:08.489 [Information] [PreviewerProcess (#48527177)] [5708] Connection initialized
19:46:08.489 [Debug] [PreviewerProcess (#48527177)] [5708] Sending message: AvaloniaUI.Previewer.Protocol.ClientSupportedPixelFormatsMessage
19:46:08.489 [Debug] [PreviewerProcess (#48527177)] [5708] Sending message: AvaloniaUI.Previewer.Protocol.ClientRenderInfoMessage
19:46:08.489 [Debug] [PreviewerProcess (#48527177)] [5708] Sending message: AvaloniaUI.Previewer.Protocol.UpdateXamlMessage
19:46:08.489 [Debug] [PreviewerProcess (#48527177)] [5708] <= Preparing Window Manager
19:46:08.493 [Debug] [PreviewerProcess (#48527177)] [5708] <= Initializing application in design mode
19:46:08.497 [Debug] [PreviewerProcess (#48527177)] [5708] <= Loading entry assembly
19:46:08.501 [Debug] [PreviewerProcess (#48527177)] [5708] <= Obtaining AppBuilder instance from AvaloniaApplication2
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <= Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Avalonia.Headless, Version=12.0.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'. The system cannot find the file specified.
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <= File name: 'Avalonia.Headless, Version=12.0.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.<StartAvaloniaApplication>g__WithHeadless|4_1(AppBuilder appBuilder)
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.c(CommandLineArgs a)
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.a(String[] a)
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.Main(String[] cmdline)
19:46:08.537 [Error] [PreviewerProcess (#48527177)] [5708] <=    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
19:46:08.541 [Error] [PreviewerProcess (#48527177)] [5708] <=    at System.Reflection.MethodInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs)
19:46:08.541 [Error] [PreviewerProcess (#48527177)] [5708] <=    at System.Reflection.MethodInvoker.InvokeDirectByRef(Object obj, Object arg1, Object arg2, Object arg3, Object arg4)
19:46:08.541 [Error] [PreviewerProcess (#48527177)] [5708] <=    at System.Reflection.MethodInvoker.InvokeImpl(Object obj, Object arg1, Object arg2, Object arg3, Object arg4)
19:46:08.541 [Error] [PreviewerProcess (#48527177)] [5708] <=    at System.Reflection.MethodInvoker.Invoke(Object obj, Span`1 arguments)
19:46:08.541 [Error] [PreviewerProcess (#48527177)] [5708] <=    at Program.<Main>$(String[] args)
19:46:09.476 [Error] [PreviewerProcess (#48527177)] Connection error
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AvaloniaUI.Previewer.Protocol.BsonStreamTransportConnection.<ReadExact>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AvaloniaUI.Previewer.Protocol.BsonStreamTransportConnection.<Reader>d__16.MoveNext()
19:46:09.478 [Information] [PreviewerProcess (#48527177)] Process exited: GenericError
19:46:09.478 [Information] [PreviewerProcess (#48527177)] Stopping previewer process
19:46:51.540 [Information] [PreviewerProcessFactory] Resolving metadata for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj' (TFM=net9.0)
19:46:51.540 [Debug] [CpsAssetsPreviewerMetadataService] Resolving previewer metadata for 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\AvaloniaApplication2.csproj' [net9.0]
19:46:51.551 [Information] [ShadowCopyOutputStrategy] Shadow copy reused at 'C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe' (4 files)
19:46:51.567 [Debug] [PreviewerProcess (#48527177)] > C:\Program Files\dotnet\dotnet.exe exec --runtimeconfig "C:\Users\Nelson Garcia\source\AvaloniaApplication2\bin\Debug\net9.0\AvaloniaApplication2.runtimeconfig.json" --depsfile "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.previewer.deps.json" --additionalprobingpath "C:\Users\Nelson Garcia\.nuget\packages" --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages"  "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaUI.Previewer.HostApp.dll" --transport tcp-bson://127.0.0.1:51718/ "C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll"
19:46:51.567 [Information] [PreviewerProcess (#48527177)] Starting previewer process for target C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll (ShadowCopy=True, NewHostApp=True)
19:46:51.570 [Information] [PreviewerProcess (#48527177)] [8740] Started previewer process for 'C:\Users\Nelson Garcia\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\AvaloniaApplication2_4Pkr2af7O2uL7rCe\AvaloniaApplication2.dll'. Waiting for connection to be initialized.
19:46:51.540 [Debug] [CpsAssetsPreviewerMetadataService] Resolving dependencies from 'C:\Users\Nelson Garcia\source\AvaloniaApplication2\bin\Debug\net9.0\AvaloniaApplication2.deps.json'.
19:46:51.544 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless, Avalonia.Markup.Xaml.Loader] (Avalonia 12.1.2, net9.0)
19:46:51.547 [Debug] [CpsAssetsPreviewerMetadataService] Resolve complete: 4 build outputs, 32 managed, 3 native, fingerprint=BwBQevK+7k6bM8jk8P0XPcMvpfRHD8EXIcVBsJGLJ80=
19:46:51.665 [Debug] [PreviewerProcess (#48527177)] [8740] <= Preparing transport
19:46:51.678 [Information] [PreviewerProcess (#48527177)] [8740] Connection initialized
19:46:51.678 [Debug] [PreviewerProcess (#48527177)] [8740] Sending message: AvaloniaUI.Previewer.Protocol.ClientSupportedPixelFormatsMessage
19:46:51.678 [Debug] [PreviewerProcess (#48527177)] [8740] Sending message: AvaloniaUI.Previewer.Protocol.ClientRenderInfoMessage
19:46:51.678 [Debug] [PreviewerProcess (#48527177)] [8740] Sending message: AvaloniaUI.Previewer.Protocol.UpdateXamlMessage
19:46:51.683 [Debug] [PreviewerProcess (#48527177)] [8740] <= Preparing Window Manager
19:46:51.685 [Debug] [PreviewerProcess (#48527177)] [8740] <= Initializing application in design mode
19:46:51.687 [Debug] [PreviewerProcess (#48527177)] [8740] <= Loading entry assembly
19:46:51.691 [Debug] [PreviewerProcess (#48527177)] [8740] <= Obtaining AppBuilder instance from AvaloniaApplication2
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <= Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Avalonia.Headless, Version=12.0.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'. The system cannot find the file specified.
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <= File name: 'Avalonia.Headless, Version=12.0.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.<StartAvaloniaApplication>g__WithHeadless|4_1(AppBuilder appBuilder)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.c(CommandLineArgs a)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.a(String[] a)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at AvaloniaUI.Previewer.DesignerSupport.EntryPoint.Main(String[] cmdline)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at System.Reflection.MethodInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at System.Reflection.MethodInvoker.InvokeDirectByRef(Object obj, Object arg1, Object arg2, Object arg3, Object arg4)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at System.Reflection.MethodInvoker.InvokeImpl(Object obj, Object arg1, Object arg2, Object arg3, Object arg4)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at System.Reflection.MethodInvoker.Invoke(Object obj, Span`1 arguments)
19:46:51.723 [Error] [PreviewerProcess (#48527177)] [8740] <=    at Program.<Main>$(String[] args)
19:46:52.632 [Error] [PreviewerProcess (#48527177)] Connection error
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AvaloniaUI.Previewer.Protocol.BsonStreamTransportConnection.<ReadExact>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AvaloniaUI.Previewer.Protocol.BsonStreamTransportConnection.<Reader>d__16.MoveNext()
19:46:52.632 [Information] [PreviewerProcess (#48527177)] Process exited: GenericError
19:46:52.632 [Information] [PreviewerProcess (#48527177)] Stopping previewer process

Additional context

Visual Studio 2022 Community v17.14

Edition	Windows 10 Home
Version	22H2
Installed on	‎6/‎26/‎2022
OS Build	19045.7291
Processor	AMD Ryzen 9 5900XT 16-Core Processor              3.30 GHz
Installed RAM	32.0 GB
Storage	1.82 TB SSD Samsung SSD 970 EVO Plus 2TB, 238 GB SSD SanDisk SDSSDP256G, 233 GB SSD Samsung SSD 850 EVO 250GB, 3.73 TB SSD TEAM TM8FPW004T
Graphics Card	NVIDIA GeForce RTX 3080 Ti (12 GB)
System Type	64-bit operating system, x64-based processor
Pen and touch	No pen or touch input is available for this display

Activity

  1. added theissue type on Oct 12, 2026
  2. 7 remaining items

  3. bonimy commented on Oct 14, 2026

    @bonimy
    Author

    Update: I migrated from VS2022 to VS2026 and the previewer here works. Will keep issue open as I'm sure VS2022 is still supposed to be in support.

  4. mrlacey commented on Oct 14, 2026

    @mrlacey
    Contributor

    @bonimy thanks for the update and glad you found a solution.
    Yes, 2022 is still supported. We'll investigate.
    Out of interest, is there a reason you hadn't updated to VS2026 already?

  5. bonimy commented on Oct 14, 2026

    @bonimy
    Author

    I hadn't updated to VS2026 simply because 2022 was still working.

    Anyway, after installing VS2026, Avalonia now works in VS2022. Not sure if that was exactly what caused the fix, but now I'm stumped.

    For the record, before installing VS2026, when the issue was happening, I installed Avalonia through the Visual Studio 2022 Marketplace. When it didn't work, I tried through command line. Still failing, I uninstalled both, and tried marketplace again, where it continued to not work.

    I don't know if it helps, but here are all of the extensions I have on VS2022:
    Image

    If time permits, I will try uninstalling VS2026 and see if Avalonia fails again.

  6. mrlacey commented on Oct 15, 2026

    @mrlacey
    Contributor

    @bonimy thanks for all the extra information.
    I think the call stack in the original report will be the most useful. It looks like a problem in the communication between the previewer process (that creates the preview images) and the display of them in the IDE.
    The good news is that you are no longer blocked by this, but we will still look to try and improve the reliability of the communication with the previewer process.

  7. maxkatz6 commented on Oct 15, 2026

    @maxkatz6
    Member

    @bonimy can you send "dotnet --info" output?

  8. bonimy commented on Oct 15, 2026

    @bonimy
    Author

    The info may not be accurate anymore, as I installed vs2026 and .net10

    .NET SDK:
     Version:           10.0.402
     Commit:            a8dd0577c5
     Workload version:  10.0.400-manifests.6055ec36
     MSBuild version:   18.9.15+a8dd0577c
    
    Runtime Environment:
     OS Name:     Windows
     OS Version:  10.0.19045
     OS Platform: Windows
     RID:         win-x64
     Base Path:   C:\Program Files\dotnet\sdk\10.0.402\
    
    .NET workloads installed:
    There are no installed workloads to display.
    Configured to use workload sets when installing new manifests.
    No workload sets are installed. Run "dotnet workload restore" to install a workload set.
    
    Host:
      Version:      10.0.13
      Architecture: x64
      Commit:       4099f83977
    
    .NET SDKs installed:
      9.0.319 [C:\Program Files\dotnet\sdk]
      10.0.113 [C:\Program Files\dotnet\sdk]
      10.0.402 [C:\Program Files\dotnet\sdk]
    
    .NET runtimes installed:
      Microsoft.AspNetCore.App 8.0.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 9.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 10.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 8.0.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 9.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 10.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.WindowsDesktop.App 8.0.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
      Microsoft.WindowsDesktop.App 9.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
      Microsoft.WindowsDesktop.App 10.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    
    Other architectures found:
      x86   [C:\Program Files (x86)\dotnet]
        registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
    
    Environment variables:
      DOTNET_ROLL_FORWARD_TO_PRERELEASE        [1]
    
    global.json file:
      Not found
    
    Learn more:
      https://aka.ms/dotnet/info
    
    Download .NET:
      https://aka.ms/dotnet/download
    
  9. mrlacey commented on Oct 30, 2026

    @mrlacey
    Contributor

    Version 12.4 of the extension is now available and includes a fix for this issue.
    Thanks for your patience while we released this fix.
    We hope you don't encounter any more problems, but if you do, please let us know, and we'll address them as quickly as possible.

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

Metadata

Metadata

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions