Skip to content

SUBCLASSPROC .NET10 issue #229

@Anthonyy232

Description

@Anthonyy232

Describe the bug

Hello, had an issue:
I think it's because in .NET 10, the CLR calls FailFast when GC'd delgate is invoked via native callback rather than silently failing, so the SUBCLASSPROC delegate isn't being kept alive properly. Maybe it has to do with how the library stores the delegate for window subclassing in a way that the GC can collect it?

`
❯ Log Name: Application Source: Windows Error Reporting Date: 3/22/2026 11:15:10 AM Event ID: 1001 Task Category: None Level: Information
Keywords:
User: SYSTEM
Computer: AnthonyPC
Description:
Fault bucket 1504007101636796414, type 5
Event Name: MoAppCrash
Response: Not available
Cab Id: 0

Problem signature:
P1: 48743Nagi.Nagi_1.7.1.0_x64__fc5rczfamx7km
P2: praid:App
P3: 1.0.0.0
P4: 69a70000
P5: coreclr.dll
P6: 10.0.526.15411
P7: 69a72d88
P8: 80131623
P9: 00000000002c5c01
P10:

Attached files:
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.5bcce3ff-7059-4054-bac4-f48b07cddd4e.tmp.mdmp
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.3d3e64b6-14a2-4d7a-8add-64ddc7378b29.tmp.WERInternalMetadata.x
ml
\?\C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_48743Nagi.Nagi_1_ecbf37ace89f2644724257de909ee1893
437b39c_35eb875d_cab_57f9eecb-8f73-4f1e-b092-ebd27586a703\WPR_initiated_DiagTrackMiniLogger_OneTrace_User_Logger
_20260321_1_EC_0_inject.etl
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.87be08ff-a16a-4c70-87cd-4c4489b82685.tmp.etl
\?\C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_48743Nagi.Nagi_1_ecbf37ace89f2644724257de909ee1893
437b39c_35eb875d_cab_57f9eecb-8f73-4f1e-b092-ebd27586a703\WPR_initiated_DiagTrackMiniLogger_WPR System
Collector_inject.etl
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.df0ebedb-b909-45c5-81bb-6b18c71de424.tmp.etl
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.ecd70d10-bd30-4a3e-9e7a-483a99d4cb7f.tmp.csv
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.717e399a-a15f-436b-839a-9d5609100832.tmp.txt
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.52202e03-1a30-4876-a8e6-0888442cdd1c.tmp.xml
\?\C:\Users\Antho\AppData\Local\Temp\WER.73f0d8e6-7144-4a9a-a6a2-6868e1104a05.tmp.appcompat.txt

These files may be available here:
\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_48743Nagi.Nagi_1_ecbf37ace89f2644724257de909ee18
93437b39c_35eb875d_57f9eecb-8f73-4f1e-b092-ebd27586a703

Analysis symbol:
Rechecking for solution: 0
Report Id: e6504c4a-9644-45a1-a50a-f72268c23db5
Report Status: 268435456
Hashed bucket: 7a798c0bed98736fc4df4e7d88b9dffe
Cab Guid: 0
Event Xml:



1001
0
4
0
0
… +206 lines …
C:\Program Files\WindowsApps\48743Nagi.Nagi_1.7.1.0_x64__fc5rczfamx7km\Nagi.exe
C:\Program
Files\WindowsApps\48743Nagi.Nagi_1.7.1.0_x64__fc5rczfamx7km\coreclr.dll
e6504c4a-9644-45a1-a50a-f72268c23db5
48743Nagi.Nagi_1.7.1.0_x64__fc5rczfamx7km
App

Log Name: Application
Source: .NET Runtime
Date: 3/22/2026 11:15:06 AM
Event ID: 1025
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: AnthonyPC
Description:
Application: Nagi.exe
CoreCLR Version: 10.0.526.15411
.NET Version: 10.0.5
Description: The application requested process termination through System.Environment.FailFast.
Message: A callback was made on a garbage collected delegate of type
'H.NotifyIcon!Windows.Win32.UI.Shell.SUBCLASSPROC::Invoke'.
Stack:
at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference,
Microsoft.UI.Xaml.ApplicationInitializationCallback)
at Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback)
at Nagi.WinUI.Program.Main(System.String[])

Event Xml:



1025
0
2
0
0
0x80000000000000

391625


Application
AnthonyPC



Application: Nagi.exe
CoreCLR Version: 10.0.526.15411
.NET Version: 10.0.5
Description: The application requested process termination through System.Environment.FailFast.
Message: A callback was made on a garbage collected delegate of type
'H.NotifyIcon!Windows.Win32.UI.Shell.SUBCLASSPROC::Invoke'.
Stack:
at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference,
Microsoft.UI.Xaml.ApplicationInitializationCallback)
at Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback)
at Nagi.WinUI.Program.Main(System.String[])



`

Steps to reproduce the bug

Not really sure how to reproduce lol... I wasn't able to reproduce very often since nature of GC

Expected behavior

Not crash/handled properly

Screenshots

No response

NuGet package version

2.4.1

Platform

WinUI

IDE

No response

Windows Version

Windows 11

WindowsAppSDK Version

No response

WindowsAppSDK Type

None

Manifest

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions