Svg.Skia
Svg.Skia copied to clipboard
Completely freezes Rider Avalonia UI visual previewer when used
New Avalonia project, using all the latest releases to day (fresh install of .Net Core, Rider, Avalonia etc...) running on a Mac.
New project, add this library using dotnet add
command line, then in a axaml file add either <svg ... />
or <Image Source="{SvgImage ...}" />
and the visual previewer in Rider completely hangs and doesn't work.
Comment it out and replace with <Image Path="image.png" />
and UI starts working again.
![image](https://user-images.githubusercontent.com/4455939/180655685-bf49c57f-96e2-4dc5-825b-053b968f6d73.png)
Tried restarts, remaking the application, and 2 machines, exactly the same issue.
Source code is here https://github.com/angelsix/youtube/tree/08a0263702ba319b0e7553ddcc7934a3ec127772/Avalonia/AvaloniaLoudnessMeter and video of issue is here https://youtu.be/VM-4NwdeXlo
Interesting didn't run into that issue yet, will investigate. One thing is that previewer is using immediate renderer while application defaults to deferred.
@angelsix It's know issue with previewer not resolving some external assemblies, unfortunately not know fix, but there is workaround to make previewer work.
Replace this lines: https://github.com/angelsix/youtube/blob/08a0263702ba319b0e7553ddcc7934a3ec127772/Avalonia/AvaloniaLoudnessMeter/Program.cs#L16-L19
with:
public static AppBuilder BuildAvaloniaApp()
{
GC.KeepAlive(typeof(SvgImageExtension).Assembly);
GC.KeepAlive(typeof(Avalonia.Svg.Skia.Svg).Assembly);
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
this will load needed assemblies for previewer.
Added comment to README so others can also find the workaround https://github.com/wieslawsoltes/Svg.Skia#avalonia-previewer
Awesome thanks that KeepAlive fixed it. Perhaps keep this open until its fixed somehow?
Awesome thanks that KeepAlive fixed it. Perhaps keep this open until its fixed somehow?
I added comment to README with the workaround, and I don't think it's easily fixable as it's related to .netcoreapp model and dependency resolution, so way bigger issue than Avalonia.