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

Use of certain GameKit APIs cause crash when running an iOS app on Mac #102964

Open
kiddkaffeine opened this issue Jun 2, 2024 · 8 comments
Open
Assignees

Comments

@kiddkaffeine
Copy link

Description

Use of certain GameKit APIs when running iOS apps on Mac can cause a crash.

Reproduction Steps

GKLocalPlayer player = GKLocalPlayer.LocalPlayer;
player.AuthenticateHandler = (vc, err) => {

Attempting to use AuthenticateHandler runs fine on an iOS device, but when the app is run on a Mac -- via TestFlight or the App Store, unsure if there's a way to do it otherwise -- this causes a crash; the provided handler is never called.

Expected behavior

No crash.

Actual behavior

Crash. I have consistently replicated this testing on a Mac via TestFlight, but never on an iOS device. The thread crash log looks as follows:

Thread 9 Crashed::  Dispatch queue: com.apple.NSXPCConnection.m-user.com.apple.gamed
0   libsystem_kernel.dylib        	       0x1941b2a60 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1941eac20 pthread_kill + 288
2   libsystem_c.dylib             	       0x1940f7a30 abort + 180
3   <redacted app name>            	       0x102b39380 sigabrt_signal_handler.cold.1 + 48 (mini-posix.c:226)
4   <redacted app name>            	       0x102af4b44 sigabrt_signal_handler + 196 (mini-posix.c:224)
5   libsystem_platform.dylib      	       0x19421b584 _sigtramp + 56
6   libsystem_pthread.dylib       	       0x1941eac20 pthread_kill + 288
7   libsystem_c.dylib             	       0x1940f7a30 abort + 180
8   libsystem_malloc.dylib        	       0x194007dc4 malloc_vreport + 896
9   libsystem_malloc.dylib        	       0x19400b430 malloc_report + 64
10  libsystem_malloc.dylib        	       0x194025494 find_zone_and_free + 528
11  libicucore.A.dylib            	       0x197367edc icu::Locale::setToBogus() + 52
12  libicucore.A.dylib            	       0x197368240 icu::Locale::operator=(icu::Locale const&) + 40
13  libicucore.A.dylib            	       0x1974cdd08 icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter(icu::number::impl::MacroProps&&, icu::Locale const&) + 216
14  libicucore.A.dylib            	       0x19746f7c0 icu::DecimalFormat::touch(UErrorCode&) + 240
15  libicucore.A.dylib            	       0x197470024 icu::DecimalFormat::DecimalFormat(icu::UnicodeString const&, icu::DecimalFormatSymbols*, UNumberFormatStyle, UErrorCode&) + 380
16  libicucore.A.dylib            	       0x1974eb718 icu::NumberFormat::makeInstance(icu::Locale const&, UNumberFormatStyle, signed char, UErrorCode&) + 1668
17  libicucore.A.dylib            	       0x1974eaec8 icu::LocaleCacheKey<icu::SharedNumberFormat>::createObject(void const*, UErrorCode&) const + 88
18  libicucore.A.dylib            	       0x1973f2d08 icu::UnifiedCache::_get(icu::CacheKeyBase const&, icu::SharedObject const*&, void const*, UErrorCode&) const + 168
19  libicucore.A.dylib            	       0x1974ebcd8 0x197348000 + 1719512
20  libicucore.A.dylib            	       0x1974eb034 0x197348000 + 1716276
21  libicucore.A.dylib            	       0x1974ea930 icu::NumberFormat::createInstance(icu::Locale const&, UNumberFormatStyle, UErrorCode&) + 112
22  libicucore.A.dylib            	       0x19753a4bc icu::SimpleDateFormat::initialize(icu::Locale const&, UErrorCode&) + 572
23  libicucore.A.dylib            	       0x197539f04 icu::SimpleDateFormat::construct(icu::DateFormat::EStyle, icu::DateFormat::EStyle, icu::Locale const&, UErrorCode&) + 2024
24  libicucore.A.dylib            	       0x19753b234 icu::SimpleDateFormat::SimpleDateFormat(icu::DateFormat::EStyle, icu::DateFormat::EStyle, icu::Locale const&, UErrorCode&) + 252
25  libicucore.A.dylib            	       0x197462254 icu::DateFormat::create(icu::DateFormat::EStyle, icu::DateFormat::EStyle, icu::Locale const&) + 172
26  libicucore.A.dylib            	       0x197571fac udat_open + 396
27  CoreFoundation                	       0x1943074a0 __cficu_udat_open + 72
28  CoreFoundation                	       0x194306854 __ResetUDateFormat + 516
29  CoreFoundation                	       0x194306624 __CreateCFDateFormatter + 324
30  CoreFoundation                	       0x194306344 -[NSDate descriptionWithLocale:] + 392
31  GameCenterFoundation          	       0x239ec1de8 -[NSObject(PrintDebugging) _gkDescription] + 32
32  GameCenterFoundation          	       0x239ec1e94 -[NSObject(PrintDebugging) _gkDescriptionWithChildren:] + 84
33  GameCenterFoundation          	       0x239eb6c44 -[GKInternalRepresentation _gkDescriptionWithChildren:] + 1328
34  CoreFoundation                	       0x1942b33dc -[NSArray descriptionWithLocale:indent:] + 492
35  Foundation                    	       0x1953c0eac _NS_os_log_callback + 284
36  libsystem_trace.dylib         	       0x193f3cc5c _os_log_fmt_flatten_NSCF + 64
37  libsystem_trace.dylib         	       0x193f3c6c0 _os_log_fmt_flatten_object + 220
38  libsystem_trace.dylib         	       0x193f3a394 _os_log_impl_flatten_and_send + 1864
39  libsystem_trace.dylib         	       0x193f39c34 _os_log + 168
40  libsystem_trace.dylib         	       0x193f39b84 _os_log_impl + 28
41  GameCenterFoundation          	       0x239ede2e8 +[GKLocalPlayer authenticatedLocalPlayersDidChange:complete:] + 264
42  GameCenterFoundation          	       0x239f2a348 -[GKDaemonProxy authenticatedPlayersDidChange:authenticatingBundleID:reply:] + 140
43  CoreFoundation                	       0x1942aa694 __invoking___ + 148
44  CoreFoundation                	       0x1942aa514 -[NSInvocation invoke] + 428
45  GameCenterFoundation          	       0x239e9cf04 -[NSInvocation(GKProxyHelpers) _gkInvokeOnce] + 24
46  GameCenterFoundation          	       0x239e9ceb4 -[GKDaemonProxy connection:handleInvocation:isReply:] + 716
47  Foundation                    	       0x195c1ed08 -[NSXPCConnection _decodeAndInvokeMessageWithEvent:reply:flags:] + 1120
48  Foundation                    	       0x195c20558 message_handler_message + 88
49  Foundation                    	       0x1953c0ad4 message_handler + 152
50  libxpc.dylib                  	       0x193ef8f74 _xpc_connection_call_event_handler + 144
51  libxpc.dylib                  	       0x193ef76e8 _xpc_connection_mach_event + 1404
52  libdispatch.dylib             	       0x19403a4a8 _dispatch_client_callout4 + 20
53  libdispatch.dylib             	       0x194056888 _dispatch_mach_msg_invoke + 468
54  libdispatch.dylib             	       0x194041898 _dispatch_lane_serial_drain + 368
55  libdispatch.dylib             	       0x1940575d8 _dispatch_mach_invoke + 444
56  libdispatch.dylib             	       0x194041898 _dispatch_lane_serial_drain + 368
57  libdispatch.dylib             	       0x194042578 _dispatch_lane_invoke + 432
58  libdispatch.dylib             	       0x19404d2d0 _dispatch_root_queue_drain_deferred_wlh + 288
59  libdispatch.dylib             	       0x19404cb44 _dispatch_workloop_worker_thread + 404
60  libsystem_pthread.dylib       	       0x1941e700c _pthread_wqthread + 288
61  libsystem_pthread.dylib       	       0x1941e5d28 start_wqthread + 8

Regression?

Unknown.

Known Workarounds

No response

Configuration

Tested on an M3 running MacOS 14.5 and iOS devices with 17.5.1.

Other information

Log appears similar to the one reported in #98941

However, reinstalling .net 8 did not help.

% dotnet --version
8.0.301
% dotnet workload list

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
macos                      14.2.8053/8.0.100      SDK 8.0.300        
ios                        17.2.8053/8.0.100      SDK 8.0.300        
tvos                       17.2.8053/8.0.100      SDK 8.0.300        
android                    34.0.95/8.0.100        SDK 8.0.300        

Use `dotnet workload search` to find additional workloads to install.
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 2, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jun 2, 2024
@filipnavara
Copy link
Member

The looks like the same issue as #98941 which was already fixed in a servicing update.

@filipnavara filipnavara added os-ios Apple iOS area-System.Globalization and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 2, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

@kiddkaffeine
Copy link
Author

@filipnavara As noted in the ticket description, however it still appears to be an issue even with the latest dotnet 8 release.

@filipnavara
Copy link
Member

Did you read all the comments? #98941 (comment) has the diagnostic steps.

@tarekgh
Copy link
Member

tarekgh commented Jun 2, 2024

CC @vitek-karas

@ivanpovazan ivanpovazan removed the untriaged New issue has not been triaged by the area owner label Jun 4, 2024
@matouskozak
Copy link
Member

@filipnavara As noted in the ticket description, however it still appears to be an issue even with the latest dotnet 8 release.

@kiddkaffeine are you still encountering the issue? If so, could you please try the step at #98941 (comment) and let us know if that helped.

@kiddkaffeine
Copy link
Author

@matouskozak still an issue, we don't use Maui so there's not a lot of Nuget content to clear, and upgrading dotnet did not help either.

We interface with a couple of other native libraries and have to use some different settings as documented in xamarin/xamarin-macios#19624, maybe that's why?

@ivanpovazan
Copy link
Member

Can you maybe provide a binary build log (binlog) of your build?
https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#binary-build-logs

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

No branches or pull requests

5 participants