Bug 39347 - Assertion when passing delegate of icall method to p/invoke
Summary: Assertion when passing delegate of icall method to p/invoke
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Interop ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-04 03:24 UTC by Alex Corrado [MSFT]
Modified: 2016-03-19 12:06 UTC (History)
3 users (show)

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


Attachments
Test case (493 bytes, text/plain)
2016-03-04 03:24 UTC, Alex Corrado [MSFT]
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:
RESOLVED FIXED

Description Alex Corrado [MSFT] 2016-03-04 03:24:16 UTC
Created attachment 15260 [details]
Test case

See attached test case.

When passing a delegate to a p/invoke call, mono crashes with this assertion if the delegate was constructed from an icall:

* Assertion at loader.c:1437, condition `method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL' not met

Look at the call to `mono_lookup_pinvoke_call` here: https://github.com/mono/mono/blob/7452477db341f1c8ec368db491bfe5653a972ce2/mono/metadata/marshal.c#L300 ... note that the guard condition for that is `mono_method_signature (method)->pinvoke`, while the assertion in `mono_lookup_pinvoke_call` checks `method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL'
Comment 1 Zoltan Varga 2016-03-19 12:06:54 UTC
Fixed in mono master c736aba5c94c20e6faad6b736f8e3a834e26d95f.