Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 15260 [details]
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'
Fixed in mono master c736aba5c94c20e6faad6b736f8e3a834e26d95f.