taublast / DrawnUi.Maui

UI Rendering Engine for .NET MAUI powered by SkiaSharp
MIT License
206 stars 15 forks source link

Crash on windows #93

Open arifu-dev opened 4 days ago

arifu-dev commented 4 days ago

Setting up a new project or running the demo projects on windows it just crashes. The app otherwise works fine if Canvas is not present. After calling InitializeComponent() it simply crashes, I can't find any exceptions, only the message: The program '[5388] MauiApp1.exe' has exited with code 3221226107 (0xc000027b).

Tried to run the demo project just in case I set up something incorrectly, the code seems to run up to MainPage.InitializeComponent(); after which the app simply closes with the message "The program '[16464] AppoMobi.Maui.DrawnUi.Demo.exe' has exited with code 3221226107 (0xc000027b)." I am unable to get any exception.

Am I missing something?

Tested on windows 10 and windows 11.

Update: I tried to walk through the library code to see at what code gets executed before the crash. It calls Measure and Arrange functions on the Canvas, but crashes before it can call Draw. The actual last line of code I can catch before it crashes is a Task.Delay function in Looper.cs line 159: await Task.Delay(TimeSpan.FromMilliseconds(timeToWaitMs), cancellationToken);

taublast commented 4 days ago

Hi! Failed repoduce this running the repository code from the main branch.

My quick theory is maybe you have an outdated fork of demo project AND/OR drawnUi, there were some breaking changes while ago? Or using an outdated nuget version?

So I'm running fine on windows 10 DrawnUi.Demo with <UseNuget>true</UseNuget> inside the .csprj and

    <PackageReference Include="DrawnUi.Maui.Camera" Version="1.2.3.8" />
    <PackageReference Include="DrawnUi.Maui.Rive" Version="1.2.3.8" />

At the same time still running okay with <UseNuget>false</UseNuget> and importing the DrawnUi repo code.

arifu-dev commented 3 days ago

Hey @taublast, apologies and a word of warning!!!! The latest visual studio update (or I guess .NET or MAUI) breaks SkiaSharp. I tried running one of my applications that uses SkiaSharp and while the old builds work perfectly well, once rebuilt it crashes as soon as the canvas is initialized. I downgraded Visual Studio to 17.8.3 and everything works fine, including your demo.

Closing this issue as it is not related to your library.

By the way so far your library looks good, one of my application is written like 90% in SkiaSharp due to the atrocious performance on android and breaking inconsistencies across platforms, I was considering putting my own solution into a library but ended up discovering this project yesterday and after I got it running now and some initial testing I'm strongly considering porting my application to use DrawnUi.Maui. Good luck and keep up the good work! 👍

taublast commented 2 days ago

Thanks! I would reopen this to investigate the cause of the crash though. Will update my VS (was avoiding to do it for obvious reasons) to force the problem to appear.