The previewer doesn't use the project that the file is part of in the previewer, it's using the executable project that references the library project, and when it's not finding the right method it self destructs.
The UI part of my app needs to be optional and based on configuration, this works at runtime, but being unable to preview is a bit of a blocker.
To Reproduce
Create a new solution
Create a console app, ZZBase
Create an avalonia .net app ZZUi
change ZZUi.csproj OutputType from WinExe to Library
Make Program public
Remove [STAThread] Attribute from ZZUi.Program.Main
Reference ZZUi from ZZBase
Call ZZUi.Program.Main(args);
Run the program and it should start the app as expected.
Open MainWindow.axaml, it should show the Process Exited error.
Output window should show the stacktrace provided.
AvaloniaVS plugin version
11.1
Avalonia version
11.0.2
Visual Studio version
17.7.3
Relevant log output
15:30:59.136 [Information] 0 Starting previewer process for '"C:\Projects\AvaTest\ZZBase\bin\Debug\net6.0\ZZBase.dll"'
15:30:59.145 [Information] 38960 Started previewer process for '"C:\Projects\AvaTest\ZZBase\bin\Debug\net6.0\ZZBase.dll"'. Waiting for connection to be initialized.
15:30:59.368 [Information] 38960 Connection initialized
15:30:59.368 [Error] 38960 <= "Unhandled exception. System.InvalidOperationException: Unable to create AppBuilder from type \"ZZBase.Program\". Input type either needs to have BuildAvaloniaApp -> AppBuilder method or inherit Application type."
15:30:59.380 [Error] 38960 <= " at Avalonia.AppBuilder.Configure(Type entryPointType)"
15:30:59.399 [Error] 38960 <= " at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(String[] cmdline)"
15:30:59.400 [Error] 38960 <= " at Avalonia.Designer.HostApp.Program.Main(String[] args)"
Describe the bug
Same issue as Rider Plugin https://github.com/ForNeVeR/AvaloniaRider/issues/301
Maybe it's not the plugins and is another issue
The previewer doesn't use the project that the file is part of in the previewer, it's using the executable project that references the library project, and when it's not finding the right method it self destructs.
The UI part of my app needs to be optional and based on configuration, this works at runtime, but being unable to preview is a bit of a blocker.
To Reproduce
ZZBase
ZZUi
WinExe
toLibrary
Program
public[STAThread]
Attribute fromZZUi.Program.Main
ZZUi
fromZZBase
ZZUi.Program.Main(args);
Run the program and it should start the app as expected.
Open
MainWindow.axaml
, it should show theProcess Exited
error.Output window should show the stacktrace provided.
AvaloniaVS plugin version
11.1
Avalonia version
11.0.2
Visual Studio version
17.7.3
Relevant log output
Additional context
No response