NSFontDescriptor.Create crashes · Issue #19659 · dotnet/macios (original) (raw)

Steps to Reproduce

var fd = NSFont.SystemFontOfSize(10).FontDescriptor;
var serif = fd.Create(NSFontDescriptorSystemDesign.Serif);
var rounded = fd.Create(NSFontDescriptorSystemDesign.Rounded);

Expected Behavior

No crash, maybe return null?

Actual Behavior

Crash (that cannot be caught with try-catch)

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib          0x184f838f0 objc_retain + 8
1   CoreFoundation       0x1853e81cc __NSSingleEntryDictionaryI_new + 204
2   CoreFoundation      0x1853bc170 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
3   UIFoundation          0x189f90514 -[NSFontDescriptor fontDescriptorWithDesign:] + 176
4   App                          0x104a1f670 xamarin_dyn_objc_msgSend + 160 (trampolines-arm64-objc_msgSend.inc.s:99)

Environment

.NET8