AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.47k stars 2.21k forks source link

XAML Previewer not loading 3rd Party Widgets #13674

Open SonarBeserk opened 10 months ago

SonarBeserk commented 10 months ago

Describe the bug

When using LiveCharts2 in a AvaloniaUI application it loads when the program is run but does not show in the designer preview.

To Reproduce

Steps to reproduce the behavior:

  1. Create any AvaloniaUI project (ex: GettingStartedApp
  2. Follow the guide for AvaloniaUI provided by LiveCharts2
  3. Fix missing x:DataType setting required on the Window not mentioned by the LiveCharts2 guide
  4. Build and Look at the project using Rider or Visual Studio
  5. Run the program to verify the chart was created but not showing the preview

Expected behavior

Based on previous work on https://github.com/AvaloniaUI/Avalonia/issues/9574 and https://github.com/AvaloniaUI/Avalonia/pull/10238 I would expect the controls to preview as expected but they do not appear to be and nothing seems to indicate why this issue occurs.

Both Rider and Visual Studio show a white screen instead of erroring.

Screenshots

2023-11-21_01-37-25

Environment

Additional context

Example project

Rider preview logs

"C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig GetStartedApp\bin\Debug\net6.0\GetStartedApp.runtimeconfig.json --depsfile GetStartedApp\bin\Debug\net6.0\GetStartedApp.deps.json .nuget\packages\avalonia\11.0.5\buildTransitive\..\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll --transport tcp-bson://127.0.0.1:61090/ --method avalonia-remote GetStartedApp\bin\Debug\net6.0\GetStartedApp.dll
Obtaining AppBuilder instance from GetStartedApp.Program
Initializing application in design mode
Sending StartDesignerSessionMessage
Process terminated with exit code -1
"C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig GetStartedApp\bin\Debug\net6.0\GetStartedApp.runtimeconfig.json --depsfile GetStartedApp\bin\Debug\net6.0\GetStartedApp.deps.json .nuget\packages\avalonia\11.0.5\buildTransitive\..\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll --transport tcp-bson://127.0.0.1:61096/ --method avalonia-remote GetStartedApp\bin\Debug\net6.0\GetStartedApp.dll
Obtaining AppBuilder instance from GetStartedApp.Program
Initializing application in design mode
Sending StartDesignerSessionMessage
maxkatz6 commented 10 months ago

Try to replace xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia" with xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Avalonia;assembly=LiveChartsCore.SkiaSharpView.Avalonia"

SonarBeserk commented 10 months ago

I have tried both using xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Avalonia;assembly=LiveChartsCore.SkiaSharpView.Avalonia" as well as removing the import so Rider's intellisense replaces the whole control with

    <avalonia:CartesianChart
        Series="{Binding Series}">
    </avalonia:CartesianChart>

which changes the xmlns entry to xmlns:avalonia="clr-namespace:LiveChartsCore.SkiaSharpView.Avalonia;assembly=LiveChartsCore.SkiaSharpView.Avalonia".

Neither correct the issue even after a build. Both show the same behavior, a white preview while the chart loads in the program.