NSAction

philstopfordphilstopford USMember
edited October 2015 in Xamarin.iOS

I'm getting an odd crash in Xamarin.Unified code :

GL.Color3(NSColor.FromDeviceRgba(ovpSettings.minorGridColor.R, ovpSettings.minorGridColor.G, ovpSettings.minorGridColor.B, ovpSettings.minorGridColor.A));

The error is :

Unable to cast object of type 'Foundation.NSActionDispatcher' to type 'AppKit.NSColor'

Call stack is :

ObjCRuntime.Runtime.GetNSObject<AppKit.NSColor>( Parameters) in /Users/builder/data/lanes/2097/b5396c29/source/maccore/src/ObjCRuntime/Runtime.cs:906
AppKit.NSColor.FromDeviceRgba( Parameters) in /Users/builder/data/lanes/2097/b5396c29/source/maccore/src/build/mac/full/AppKit/NSColor.g.cs:603
otkViewPort_demo.OpenGLLayer.drawGrid() in /Volumes/Phil/Documents/development/XXX/OpenGLLayer.cs:225
otkViewPort_demo.OpenGLLayer.DrawInCGLContext( Parameters) in /Volumes/Phil/Documents/development/XXX/OpenGLLayer.cs:151
AppKit.NSApplication.NSApplicationMain() in 
AppKit.NSApplication.Main( Parameters) in /Users/builder/data/lanes/2097/b5396c29/source/maccore/src/AppKit/NSApplication.cs:94
otkViewPort_demo.MainClass.Main( Parameters) in /Volumes/Phil/Documents/development/XXX/Main.cs:14

I can't understand why this is happening. Any suggestions would be welcome.

Best Answers

Answers

  • TimothyRisiXMTimothyRisiXM USXamarin Team Xamurai

    Hi Phil,

    Could you provide some more information on what versions of OS X, Xamarin Studio, Xamarin.Mac, and Xcode you are using? I tested on Yosemite using both the Stable and Alpha channels and was unable to reproduce the error you posted. If you can get me more info about your environment it will help me narrow down what environment to test on to see if I can find the issue. If you can zip a small sample project that exhibits the issue it would also be helpful.

  • philstopfordphilstopford USMember

    OS X 10.11.1
    Xamarin Studio 5.10.0.811
    XCode 7.1
    Xamarin.Mac 2.4.0.79

    Project archive is here :

    https://dropbox.com/s/kqbbzu2n5y8i9z0/OpenGL_updating.zip?dl=0

    Build it, run it and hit the '1Thread' button.

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    I can reproduce this on my 10.11 machine but Tim can not reproduce on 10.10. I'll take a look and get back to you.

  • philstopfordphilstopford USMember

    Hmm. Might this also have something to do with my continuing struggle to get a robust and fast multithreaded GUI application based on an updated version of the previous code I sent to you? It seems like something falls off a cliff here compared to the headless code. I'm not able to explain it otherwise.

  • philstopfordphilstopford USMember

    Trying to supply that argument, I simply get a crash on launch:

    Process:               OpenGLLayer [55653]
    Path:                  /Volumes/VOLUME/*/OpenGLLayer.app/Contents/MacOS/OpenGLLayer
    Identifier:            com.yourcompany.OpenGLLayer
    Version:               1
    Code Type:             X86-64 (Native)
    Parent Process:        ??? [1]
    Responsible:           OpenGLLayer [55653]
    User ID:               501
    
    Date/Time:             2015-10-30 14:35:00.091 -0400
    OS Version:            Mac OS X 10.11.1 (15B42)
    Report Version:        11
    Anonymous UUID:        8A8DACB8-87AB-49EC-4841-F5E5219F6BD1
    
    Sleep/Wake UUID:       8D930BA3-2A97-4FBC-B0DE-342C7390720A
    
    Time Awake Since Boot: 250000 seconds
    Time Since Wake:       20000 seconds
    
    System Integrity Protection: disabled
    
    Crashed Thread:        0  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_BAD_ACCESS (SIGABRT)
    Exception Codes:       EXC_I386_GPFLT
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Application Specific Information:
    abort() called
    
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib          0x00007fff948c70ae __pthread_kill + 10
    1   libsystem_pthread.dylib         0x00007fff8dc6c500 pthread_kill + 90
    2   libsystem_c.dylib               0x00007fff8f22a37b abort + 129
    3   com.yourcompany.OpenGLLayer     0x00000001000f8952 mono_handle_native_sigsegv + 578 (mini-exceptions.c:2232)
    4   com.yourcompany.OpenGLLayer     0x000000010006f8aa mono_arch_handle_altstack_exception + 90 (exceptions-amd64.c:818)
    5   com.yourcompany.OpenGLLayer     0x0000000100102c1e mono_sigsegv_signal_handler + 430 (mini-runtime.c:2479)
    6   libsystem_platform.dylib        0x00007fff8878352a _sigtramp + 26
    7   ???                             000000000000000000 0 + 0
    8   com.yourcompany.OpenGLLayer     0x00000001002b7573 -[otkViewPort_demo_OpenGLLayer copyCGLPixelFormatForDisplayMask:] + 99
    9   com.apple.QuartzCore            0x00007fff8e933be4 CAOpenGLLayerDraw(CAOpenGLLayer*, double, CVTimeStamp const*, unsigned int) + 291
    10  com.apple.QuartzCore            0x00007fff8e933935 -[CAOpenGLLayer _display] + 352
    11  com.apple.QuartzCore            0x00007fff8e8d7d05 CA::Layer::display_if_needed(CA::Transaction*) + 603
    12  com.apple.QuartzCore            0x00007fff8e8d782d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 35
    13  com.apple.QuartzCore            0x00007fff8e8d6d01 CA::Context::commit_transaction(CA::Transaction*) + 277
    14  com.apple.QuartzCore            0x00007fff8e8d694c CA::Transaction::commit() + 508
    15  com.apple.QuartzCore            0x00007fff8e8e213b CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 71
    16  com.apple.CoreFoundation        0x00007fff893f3097 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    17  com.apple.CoreFoundation        0x00007fff893f3007 __CFRunLoopDoObservers + 391
    18  com.apple.CoreFoundation        0x00007fff893d1fe8 CFRunLoopRunSpecific + 328
    19  com.apple.HIToolbox             0x00007fff93b18d55 RunCurrentEventLoopInMode + 235
    20  com.apple.HIToolbox             0x00007fff93b18a97 ReceiveNextEventCommon + 184
    21  com.apple.HIToolbox             0x00007fff93b189cf _BlockUntilNextEventMatchingListInModeWithFilter + 71
    22  com.apple.AppKit                0x00007fff974e4d96 _DPSNextEvent + 1067
    23  com.apple.AppKit                0x00007fff974e41c5 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
    24  com.apple.AppKit                0x00007fff974d8d28 -[NSApplication run] + 682
    25  com.apple.AppKit                0x00007fff974a1fbe NSApplicationMain + 1176
    26  ???                             0x0000000107fe8651 0 + 4429088337
    27  ???                             0x0000000107fe82e5 0 + 4429087461
    28  com.yourcompany.OpenGLLayer     0x0000000100105405 mono_jit_runtime_invoke + 1765 (mini-runtime.c:2334)
    29  com.yourcompany.OpenGLLayer     0x00000001001ac5ae mono_runtime_invoke + 110 (object.c:2783)
    30  com.yourcompany.OpenGLLayer     0x00000001001b1cfb mono_runtime_exec_main + 379 (object.c:4038)
    31  com.yourcompany.OpenGLLayer     0x00000001000694a3 mono_main + 8003 (driver.g.c:2065)
    32  com.yourcompany.OpenGLLayer     0x00000001000178d5 main + 789 (launcher.m:541)
    33  com.yourcompany.OpenGLLayer     0x0000000100002594 start + 52
    
  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    From reading the patch in question, I think if you run into this you will get the wrong type returned (NSString instead of NSColor). It shouldn't be related to this crash ^.

    These lines:

    3 com.yourcompany.OpenGLLayer 0x00000001000f8952 mono_handle_native_sigsegv + 578 (mini-exceptions.c:2232)
    4 com.yourcompany.OpenGLLayer 0x000000010006f8aa mono_arch_handle_altstack_exception + 90 (exceptions-amd64.c:818)
    5 com.yourcompany.OpenGLLayer 0x0000000100102c1e mono_sigsegv_signal_handler + 430 (mini-runtime.c:2479)
    6 libsystem_platform.dylib 0x00007fff8878352a _sigtramp + 26
    7 ??? 000000000000000000 0 + 0
    8 com.yourcompany.OpenGLLayer 0x00000001002b7573 -[otkViewPort_demo_OpenGLLayer copyCGLPixelFormatForDisplayMask:] + 99

    Make it appear that we're blitting some open gl stuff, reading bad data, and crashing. It could be user data or possibly (less likely a binding issue).

    I don't see that crash on launch here. Does it crash consistency?

  • philstopfordphilstopford USMember

    All I did was take the example project above, add the --registrar=static to the mmp additional arguments line and then build it and run it. It crashes consistently. This is also true if I try and use this argument with the main project. They both just crash on startup. Removing that build argument, they build but have the issue of locking up/crashing at some point in time.

  • OK. The updated alpha build has resolved this, and it's also unlocked a substantial performance boost in my main application. However, I get a crash. I'll post that in a new thread. Thanks for the fix!

Sign In or Register to comment.