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.
When embedding Mono if Assembly.GetExecutingAssembly() is called in a native to managed callback, eg. through a delegate passed through a pinvoke to native, then the application will crash. This appears to be an issue with mono_stack_walk_no_il in icall.c at line 4856, where dest is still NULL, causing an exception. This can be avoided in personally written code, however in places the CLR calls it, for example https://github.com/mono/mono/blob/8752d92528a1d77d71d9bc7882b04df64e40c452/mcs/class/corlib/System.Text/Encoding.cs at line 462. This causes issues with functions that should be trivial such as Console.SetOut(). This same bug also appears to be related to https://bugzilla.xamarin.com/show_bug.cgi?id=9365 and in my experience both occur at the same time. In my code, my Main function can be debugged, but the callbacks cannot.
Repro can be found at https://bitbucket.org/ben1066/embedded-mono-repro/src
Fixed in master/2.10 by: