Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on windows #93

Closed
arifu-dev opened this issue Oct 11, 2024 · 11 comments · Fixed by #99
Closed

Crash on windows #93

arifu-dev opened this issue Oct 11, 2024 · 11 comments · Fixed by #99
Assignees

Comments

@arifu-dev
Copy link

arifu-dev commented Oct 11, 2024

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 taublast self-assigned this Oct 12, 2024
@taublast
Copy link
Owner

taublast commented Oct 12, 2024

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
Copy link
Author

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
Copy link
Owner

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.

@taublast taublast reopened this Oct 14, 2024
@taublast taublast pinned this issue Oct 18, 2024
@taublast
Copy link
Owner

taublast commented Oct 18, 2024

I was sitting on 17.10 working fine.
After upgrading to 17.11.5 i'm now getting an unhandled Win32 exception when running Sandbox app on Debug. Funny enough this prompts to launch another instance of VS to debug this.

Take my bet this is related to their new XAML Live preview window, enabled by default in this new VS version, that crashes VS when its code meets a skiasharp canvas :) Investigating..

@taublast
Copy link
Owner

taublast commented Oct 18, 2024

so basically one can just include a simple

      <skiasharp:SKCanvasView
          BackgroundColor="DarkSlateBlue"
          HorizontalOptions="Fill"
          VerticalOptions="Fill"/>

to make VS crash, the drawn UI is indeed unrelated.

@taublast
Copy link
Owner

image

@taublast
Copy link
Owner

@arifu-dev
Copy link
Author

Yep, that's exactly what I've experienced as well, although on one machine I would not even be prompted to debug on a new instance, it just crashes and the debugger doesn't catch it.
MAUI has been such a frustrating experience overall, the least they could do is not break it further lol.

@taublast
Copy link
Owner

Related to Mapsui/Mapsui#2758 and dotnet/maui#25160

@taublast
Copy link
Owner

@arifu-dev upgrading all your skiasharp-related nugets to 2.88.9-preview.2.2 would solve this for existing projects

@arifu-dev
Copy link
Author

Good to know, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants