Forum Xamarin.Mac

Crash, how to diagnose?

FractorFractor Member ✭✭
edited September 8 in Xamarin.Mac

Hi,

I have a Xamarin.Mac audio application that uses AVAudioEngine and related classes. It observes the AVAudioEngineConfigurationChangeNotification and responds to changes in the default output device, by reconfiguring the audio engine.

I think I'd claim it's pretty stable on the whole. However, if I go into the system audio settings and change the default output device rapidly enough, for long enough, it crashes, with the native stacktrace shown below.

Now, I'm prepared to accept the fault is mine, somewhere yet to be discovered. However, I'm just trying to work out what the stack trace is telling me and if the fault is in my code, how do I use this to help me find where the fault is?

Thanks.

0x1099e6526 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_dump_native_crash_info
0x1099da115 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_handle_native_crash
0x109ce1377 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : altstack_handle_and_restore.cold.1
0x10995752e - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : altstack_handle_and_restore
0x7fff34ffb3da - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : CFBasicHashGetBucket
0x7fff350249dd - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : CFBasicHashGetElements
0x7fff3504d90c - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : CFRunLoopTimerInvalidate
0x7fff33c78426 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : RemoveEventLoopTimer
0x7fff33c766b8 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : TSMHandleAppActivatedEvent
0x7fff33c7656c - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : TSMSimulateAppActivated
0x7fff33c6eab9 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : TSMHandleCGNotification
0x7fff33c6b053 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _ZL30HandleCGEventsBeforeConversionP9__CGEvent
0x7fff33c7793b - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _ZL15Convert1CGEventh
0x7fff33c77819 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _ZL16MainLoopObserverjP14OpaqueEventRefPv
0x7fff33c360b9 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _NotifyEventLoopObservers
0x7fff33c5da7d - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : RunCurrentEventLoopInMode
0x7fff33c5d6f4 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : ReceiveNextEventCommon
0x7fff33c5d579 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _BlockUntilNextEventMatchingListInModeWithFilter
0x7fff322a3039 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : _DPSNextEvent
0x7fff322a1880 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
0x7fff3229358e - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication run]
0x7fff32265396 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : NSApplicationMain
0x111957f67 - Unknown
0x111957c13 - Unknown
0x10cbd183b - Unknown
0x10cbd19b1 - Unknown
0x1099f0e4e - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_jit_runtime_invoke
0x109b25ee8 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_runtime_invoke_checked
0x109b2d215 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_runtime_exec_main_checked
0x10994d2bc - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_jit_exec
0x1099503b6 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_main
0x10990533c - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : xamarin_main
0x109906184 - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : main
0x7fff6f09dcc9 - /usr/lib/system/libdyld.dylib : start
0x1 - Unknown
Tagged:

Answers

  • FractorFractor Member ✭✭
    edited September 8

    Here's an extract of the handler related code:

    // Part of audio initialization:
    _observer = NSNotificationCenter.DefaultCenter.AddObserver(
        (NSString)"AVAudioEngineConfigurationChangeNotification", HandleAudioEngineConfigurationChange, _audioEngine);
    
    // Config change handler:
        void HandleAudioEngineConfigurationChange(NSNotification obj)
        {
            DispatchQueue.MainQueue.DispatchBarrierAsync(() =>
            {
                    // Reinitialize the audio engine
            });
        }
    
  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    It may be significantly easier to debug this if you AOT your application so this segment of your crash report:

    0x7fff32265396 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : NSApplicationMain
    0x111957f67 - Unknown
    0x111957c13 - Unknown
    0x10cbd183b - Unknown
    0x10cbd19b1 - Unknown
    0x1099f0e4e - /Users/TestUser/Projects/TestApp/TestApp.Mac/bin/Debug/TestApp.app/Contents/MacOS/TestApp : mono_jit_runtime_invoke
    

    might have symbols.

  • FractorFractor Member ✭✭

    Thanks Chris, I'm having trouble reproducing that error now, but will have the AOT setting in my pocket for the future.

Sign In or Register to comment.