Bug 35545 - Mono cannot marshal a parameter that is a function pointer which takes a function pointer as a parameter
Summary: Mono cannot marshal a parameter that is a function pointer which takes a func...
Status: VERIFIED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Interop (show other bugs)
Version: 4.2.0 (C6)
Hardware: PC Mac OS
: --- normal
Target Milestone: (C6SR1)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-04 14:29 UTC by Chris Hamons
Modified: 2016-01-28 19:21 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Case (10.03 KB, application/zip)
2015-11-04 14:29 UTC, Chris Hamons
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Chris Hamons 2015-11-04 14:29:23 UTC
Created attachment 13673 [details]
Test Case

Found in this desk case:

https://kb.xamarin.com/agent/case/226313

This simple example will crash when you try to call CreateTestClassWithCallBack2.

A test case (with a simple C# console application) is attached. I can also reproduce the issue in a XM Unified Mobile application.

While trivial, the source code for the native library can be found on the desk case. (32-bit binary included in test case attached). 

I have Mono 4.2.1 (explicit/804ddbc) installed.

Stack Trace:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.LKzwZ3'
Executing commands in '/tmp/mono-gdb-commands.LKzwZ3'.
(lldb) process attach --pid 89097
Process 89097 stopped
* thread #1: tid = 0x10aeef, 0x97204e16 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x97204e16 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x97204e16 <+10>: jae    0x97204e26                ; <+26>
    0x97204e18 <+12>: calll  0x97204e1d                ; <+17>
    0x97204e1d <+17>: popl   %edx
    0x97204e1e <+18>: movl   0x9aea207(%edx), %edx

Executable module set to "/Library/Frameworks/Mono.framework/Versions/4.2.1/bin/mono".
Architecture set to: i386-apple-macosx.
(lldb) thread list
Process 89097 stopped
* thread #1: tid = 0x10aeef, 0x97204e16 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x10aef0, 0x97204512 libsystem_kernel.dylib`__psynch_cvwait + 10
  thread #3: tid = 0x10aef2, 0x971fea0a libsystem_kernel.dylib`semaphore_wait_trap + 10
  thread #4: tid = 0x10aef3, 0x972058ce libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
  thread #5: tid = 0x10aef4, 0x9720476e libsystem_kernel.dylib`__recvfrom + 10
(lldb) thread backtrace all
* thread #1: tid = 0x10aeef, 0x97204e16 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x97204e16 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x950c7b19 libsystem_c.dylib`waitpid$UNIX2003 + 48
    frame #2: 0x001b939d mono`mono_handle_native_sigsegv(signal=6, ctx=0xbff0630c, info=0xbff062cc) + 541 at mini-exceptions.c:2193 [opt]
    frame #3: 0x002098e1 mono`sigabrt_signal_handler(_dummy=<unavailable>, _info=<unavailable>, context=<unavailable>) + 129 at mini-posix.c:208 [opt]

  thread #2: tid = 0x10aef0, 0x97204512 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x97204512 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x94c54163 libsystem_pthread.dylib`_pthread_cond_wait + 726
    frame #2: 0x94c57528 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
    frame #3: 0x0032c852 mono`thread_func(thread_data=0x00000000) + 466 at sgen-thread-pool.c:118 [opt]
    frame #4: 0x94c53c25 libsystem_pthread.dylib`_pthread_body + 138
    frame #5: 0x94c53b9b libsystem_pthread.dylib`_pthread_start + 162
    frame #6: 0x94c50e32 libsystem_pthread.dylib`thread_start + 34

  thread #3: tid = 0x10aef2, 0x971fea0a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x971fea0a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0034f34a mono`mono_sem_wait(sem=0x0042f08c, alertable=1) + 26 at mono-semaphore.c:109 [opt]
    frame #2: 0x002cc44e mono`finalizer_thread(unused=0x00000000) + 158 at gc.c:1096 [opt]
    frame #3: 0x002a666c mono`start_wrapper [inlined] start_wrapper_internal + 463 at threads.c:723 [opt]
    frame #4: 0x002a649d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:770 [opt]
    frame #5: 0x00356ee0 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:97 [opt]
    frame #6: 0x94c53c25 libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x94c53b9b libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x94c50e32 libsystem_pthread.dylib`thread_start + 34

  thread #4: tid = 0x10aef3, 0x972058ce libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x972058ce libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x92839ce3 libdispatch.dylib`_dispatch_mgr_invoke + 245
    frame #2: 0x928398c6 libdispatch.dylib`_dispatch_mgr_thread + 52

  thread #5: tid = 0x10aef4, 0x9720476e libsystem_kernel.dylib`__recvfrom + 10
    frame #0: 0x9720476e libsystem_kernel.dylib`__recvfrom + 10
    frame #1: 0x950c7d26 libsystem_c.dylib`recv$UNIX2003 + 55
    frame #2: 0x001edc38 mono`socket_transport_recv(buf=<unavailable>, len=<unavailable>) + 168 at debugger-agent.c:1130 [opt]
    frame #3: 0x001dee27 mono`debugger_thread [inlined] transport_recv(len=11) + 35 at debugger-agent.c:1515 [opt]
    frame #4: 0x001dee04 mono`debugger_thread(arg=0x00000000) + 1572 at debugger-agent.c:9563 [opt]
    frame #5: 0x00356ee0 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:97 [opt]
    frame #6: 0x94c53c25 libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x94c53b9b libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x94c50e32 libsystem_pthread.dylib`thread_start + 34
(lldb) detach

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

(lldb) quit
Process 89097 detached
Abort trap: 6
Comment 1 Zoltan Varga 2015-11-04 16:27:56 UTC
Should be fixed by mono master d8d944c72c4ed605f5a587688e5303704b1044b5.
Comment 2 Rajneesh Kumar 2015-12-15 15:30:04 UTC
I have checked this issue with the following Master build: MonoFramework-MDK-4.3.2.34.macos10.xamarin.universal_f81f8763c1ae3c544ecf9a8404e1fe5ea1fb489e
xamarin.mac-2.5.0.2032-mono-invoke

I observed that the attached test sample within this bug run successfully.

Screencast: http://www.screencast.com/t/LYt7AO1OWVC


I will Re-Verify this issue when fix will merged in release branch.

Thanks...!
Comment 3 Rajneesh Kumar 2015-12-16 15:05:11 UTC
I have checked this issue with the following build: MonoFramework-MDK-4.2.1.17.macos10.xamarin.x86_2e19bf113b3f02634b4745adaa420c9f84653ee0
xamarin.mac-2.4.1.4_fe82fc3f80eb584583e2c1934c760425dc42d29b

I observed that the attached test sample within this bug run successfully, without any crash/exception.

Screencast: http://www.screencast.com/t/O99nzIzrMZ

This issue has been merged in release branch and working as expected, hence I am closing this issue.

Thanks...!