Skip to content

[BUG] [WinUI 3 / MAUI, 9.0 Preview 6, SkiaSharp 3.0-preview4.1] SKGLView crashes WinUI 3 MAUI App when the app is built in the unpackaged mode #2968

Open
@TommiGustafsson-HMP

Description

@TommiGustafsson-HMP

Description

Technology stack

  • .NET 9.0 Preview 6
  • .NET MAUI 9.0 Preview 6
  • SkiaSharp 3.0-preview4.1
  • Windows / WinUI 3 1.5.x

Bug

SKGLView crashes the app at runtime when .NET MAUI App is built in the unpackaged mode (-p:WindowsPackageType=None).

Code

Steps to reproduce the bug

  1. Clone the public reproduction repository (link) and open the solution in Visual Studio 2022 Preview (latest).
  2. First, let's check that things work in the packaged mode.
  3. Select Windows Machine and click the green Debug button.
  4. The app should start.
  5. Click the Click Me button. A new page with some text should open. The app will not crash.
  6. Close the app and go back to Visual Studio 2022 Preview.
  7. Open the Developer PowerShell and check that you are in the solution folder.
  8. Delete bin and obj folders. (Otherwise the unpackaged app will not start.)
  9. Build the unpackaged app with dotnet build -f:net9.0-windows10.0.19041.0 -c:Debug -p:WindowsPackageType=None -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsAppSDKSelfContained=true
  10. Open File Explorer and go to bin\Debug\net9.0-windows10.0.19041.0\win10-x64. The unpackaged app should be there.
  11. Click on WindowsMauiUnpackagedSKGLViewError.exe.
  12. The app will start.
  13. Click on the Click me button.
  14. The app will crash.
  15. Now, open Event Viewer and see the Windows Logs → Application error messages.

Expected Behavior

The app would not crash at runtime.

Actual Behavior

The app crashes in the OnLoaded event of AngleSwapChainPanel at runtime.

Version of SkiaSharp

3.x (Alpha)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Edition Windows 11 Pro
Version 23H2
OS build 22631.3958
Experience Windows Feature Experience Pack 1000.22700.1026.0

Devices

Processor 13th Gen Intel(R) Core(TM) i9-13980HX 2.20 GHz
Installed RAM 32,0 GB (31,6 GB usable)
System type 64-bit operating system, x64-based processor

Relevant Screenshots

No response

Relevant Log Output

Log Name:      Application
Source:        .NET Runtime
Date:          20.7.2024 21.57.32
Event ID:      1026
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Description:
Application: WindowsMauiUnpackagedSKGLViewError.exe
CoreCLR Version: 9.0.24.32707
.NET Version: 9.0.0-preview.6.24327.7
Description: The process was terminated due to an unhandled exception.
Stack:
   at SkiaSharp.Views.GlesInterop.Egl.eglGetPlatformDisplayEXT(UInt32, IntPtr, Int32[])
   at SkiaSharp.Views.GlesInterop.Egl.eglGetPlatformDisplayEXT(UInt32, IntPtr, Int32[])
   at SkiaSharp.Views.GlesInterop.GlesContext.InitializeDisplay()
   at SkiaSharp.Views.GlesInterop.GlesContext..ctor()
   at SkiaSharp.Views.Windows.AngleSwapChainPanel.OnLoaded(System.Object, Microsoft.UI.Xaml.RoutedEventArgs)
   at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler+EventState.<GetEventInvoke>b__1_0(System.Object, Microsoft.UI.Xaml.RoutedEventArgs)
   at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr, IntPtr, IntPtr)
   at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference, Microsoft.UI.Xaml.ApplicationInitializationCallback)
   at Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback)
   at WindowsMauiUnpackagedSKGLViewError.WinUI.Program.Main(System.String[])

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name=".NET Runtime" />
    <EventID Qualifiers="0">1026</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2024-07-20T18:57:32.8237381Z" />
    <EventRecordID>82274</EventRecordID>
    <Correlation />
    <Execution ProcessID="2176" ThreadID="0" />
    <Channel>Application</Channel>
  </System>
  <EventData>
    <Data>Application: WindowsMauiUnpackagedSKGLViewError.exe
CoreCLR Version: 9.0.24.32707
.NET Version: 9.0.0-preview.6.24327.7
Description: The process was terminated due to an unhandled exception.
Stack:
   at SkiaSharp.Views.GlesInterop.Egl.eglGetPlatformDisplayEXT(UInt32, IntPtr, Int32[])
   at SkiaSharp.Views.GlesInterop.Egl.eglGetPlatformDisplayEXT(UInt32, IntPtr, Int32[])
   at SkiaSharp.Views.GlesInterop.GlesContext.InitializeDisplay()
   at SkiaSharp.Views.GlesInterop.GlesContext..ctor()
   at SkiaSharp.Views.Windows.AngleSwapChainPanel.OnLoaded(System.Object, Microsoft.UI.Xaml.RoutedEventArgs)
   at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler+EventState.&lt;GetEventInvoke&gt;b__1_0(System.Object, Microsoft.UI.Xaml.RoutedEventArgs)
   at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr, IntPtr, IntPtr)
   at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference, Microsoft.UI.Xaml.ApplicationInitializationCallback)
   at Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback)
   at WindowsMauiUnpackagedSKGLViewError.WinUI.Program.Main(System.String[])
</Data>
  </EventData>
</Event>

Log Name:      Application
Source:        Application Error
Date:          20.7.2024 21.57.33
Event ID:      1000
Task Category: Application Crashing Events
Level:         Error
Keywords:      
Description:
Faulting application name: WindowsMauiUnpackagedSKGLViewError.exe, version: 1.0.0.0, time stamp: 0x667d0000
Faulting module name: coreclr.dll, version: 9.0.24.32707, time stamp: 0x667de227
Exception code: 0xc0000005
Fault offset: 0x00000000002de54e
Faulting process ID: 0x0x880
Faulting application start time: 0x0x1DADAD6AC829340
Faulting application path: C:\hmp\WindowsMauiUnpackagedSKGLViewError\WindowsMauiUnpackagedSKGLViewError\WindowsMauiUnpackagedSKGLViewError\bin\Debug\net9.0-windows10.0.19041.0\win10-x64\WindowsMauiUnpackagedSKGLViewError.exe
Faulting module path: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.0-preview.6.24327.7\coreclr.dll
Report ID: 3e1585be-c9dd-41c0-aa20-9933b81efeae
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" Guid="{a0e9b465-b939-57d7-b27d-95d8e925ff57}" />
    <EventID>1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000000</Keywords>
    <TimeCreated SystemTime="2024-07-20T18:57:33.1772821Z" />
    <EventRecordID>82275</EventRecordID>
    <Correlation />
    <Execution ProcessID="52744" ThreadID="31284" />
    <Channel>Application</Channel>
  </System>
  <EventData>
    <Data Name="AppName">WindowsMauiUnpackagedSKGLViewError.exe</Data>
    <Data Name="AppVersion">1.0.0.0</Data>
    <Data Name="AppTimeStamp">667d0000</Data>
    <Data Name="ModuleName">coreclr.dll</Data>
    <Data Name="ModuleVersion">9.0.24.32707</Data>
    <Data Name="ModuleTimeStamp">667de227</Data>
    <Data Name="ExceptionCode">c0000005</Data>
    <Data Name="FaultingOffset">00000000002de54e</Data>
    <Data Name="ProcessId">0x880</Data>
    <Data Name="ProcessCreationTime">0x1dadad6ac829340</Data>
    <Data Name="AppPath">C:\hmp\WindowsMauiUnpackagedSKGLViewError\WindowsMauiUnpackagedSKGLViewError\WindowsMauiUnpackagedSKGLViewError\bin\Debug\net9.0-windows10.0.19041.0\win10-x64\WindowsMauiUnpackagedSKGLViewError.exe</Data>
    <Data Name="ModulePath">C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.0-preview.6.24327.7\coreclr.dll</Data>
    <Data Name="IntegratorReportId">3e1585be-c9dd-41c0-aa20-9933b81efeae</Data>
    <Data Name="PackageFullName">
    </Data>
    <Data Name="PackageRelativeAppId">
    </Data>
  </EventData>
</Event>

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Ready For Work

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions