IngvarX/Camelot

Failed to preview MainWindow.xaml in VS2019

smilovich opened this issue · 1 comments

When I'm trying to open XAML preview in VS 2019 with "Avalonia for Visual Studio" extension, I'm getting the following error in output window:

20:58:31.975 [Information] 0 Starting previewer process for '"C:\Projects\!Avalonia\Camelot-master\src\Camelot\bin\Debug\netcoreapp3.1\camelot.dll"' 20:58:31.978 [Information] 23952 Started previewer process for '"C:\Projects\!Avalonia\Camelot-master\src\Camelot\bin\Debug\netcoreapp3.1\camelot.dll"'. Waiting for connection to be initialized. 20:58:32.181 [Information] 23952 Connection initialized 20:58:33.126 [Error] 23952 <= "Unhandled exception. System.InvalidOperationException: Failed to resolve object of type Camelot.Services.Abstractions.IThemeService" 20:58:33.127 [Error] 23952 <= " at Camelot.DependencyInjection.ReadonlyDependencyResolverExtensions.GetRequiredService[TService](IReadonlyDependencyResolver resolver) in C:\Projects\!Avalonia\Camelot-master\src\Camelot\DependencyInjection\ReadonlyDependencyResolverExtensions.cs:line 16" 20:58:33.128 [Error] 23952 <= " at Camelot.App.GetRequiredService[T]() in C:\Projects\!Avalonia\Camelot-master\src\Camelot\App.xaml.cs:line 73" 20:58:33.131 [Error] 23952 <= " at Camelot.App.LoadTheme() in C:\Projects\!Avalonia\Camelot-master\src\Camelot\App.xaml.cs:line 46" 20:58:33.132 [Error] 23952 <= " at Camelot.App.LoadSettings() in C:\Projects\!Avalonia\Camelot-master\src\Camelot\App.xaml.cs:line 40" 20:58:33.133 [Error] 23952 <= " at Camelot.App.Initialize() in C:\Projects\!Avalonia\Camelot-master\src\Camelot\App.xaml.cs:line 21" 20:58:33.135 [Error] 23952 <= " at Avalonia.Controls.AppBuilderBase1.Setup() in //src/Avalonia.Controls/AppBuilderBase.cs:line 311"
20:58:33.136 [Error] 23952 <= " at Avalonia.Controls.AppBuilderBase1.SetupWithoutStarting() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 168" 20:58:33.139 [Error] 23952 <= " at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.AppInitializer1.ConfigureApp(IAvaloniaRemoteTransportConnection transport, CommandLineArgs args, Object obj) in /
/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs:line 155"
20:58:33.140 [Error] 23952 <= " at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(String[] cmdline) in //src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs:line 179"
20:58:33.141 [Error] 23952 <= " at Avalonia.Designer.HostApp.Program.Main(String[] args) in /
/src/tools/Avalonia.Designer.HostApp/Program.cs:line 48"
20:58:35.374 [Information] Process exited
20:58:35.375 [Information] Stopping previewer process
20:58:35.374 [Error] 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.IO.Stream.<>c.b__43_1(Stream stream, IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncTrimPromise1.Complete(TInstance thisRef, Func3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Avalonia.Remote.Protocol.BsonStreamTransportConnection.<ReadExact>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Avalonia.Remote.Protocol.BsonStreamTransportConnection.<Reader>d__16.MoveNext()
I'm a new in Avalonia. So, maybe I just don't know something about project setup.

Hello!

I'm not familiar with Avalonia extension for VS but I guess it is unable to show preview due to constructor arguments. For such purpose default constructor could help but I didn't add it because code easily becomes messy. So preview won't for Camelot at all I think