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.
C# COM Interop code that works with mono 3.0.12 and earily now causes crashes with mono 3.1.1 and newer. (I've tested up to mono 3.2.8)
Caused by the following commit:
Author: Rodrigo Kumpera <firstname.lastname@example.org>
Date: Fri Jun 21 20:31:02 2013 -0400
When compiling gshared code, always use the cached isinst/castclass as it's faster than the cached one.
It difficult to provide a small self contained test case, but I will attempt to describe the crash:
Give a COM object, SomeComObject, that implements in interfaces IOne and ITwo, where IOne has a SomeMethod method;
The first time code like this is executed:
IOne someComObject = ....;
The C++ COM objects SomeMethod is correctly called.
However if this same code is re-executed a second time on a different instance of SomeComObject, the call to someComObject.SomeMethod(); crashes. (somewhere in the emitted marshing code, it looks like).
What seems to be happening is that for the second call, mono is incorrectly attempting to call a method on ITwo.
On a test mono build I've reversed the patch for e3866aa09217c5fe86ef9fe8d3bba3a618bc3ec5 and it fixes the crash.
You can also run mono with -O=-gshared as a workaround.
Does -O=-gshared fix for you?
Yes - Settings -O=-gshared does indeed prevent the crash.
This does appear to be a workaround however rather than fixing the bug.
Can you still reproduce with latest version of Mono? If so, could you please provide a test case that reproduce the issue? Thank you.
Please reopen if you can still reproduce. Thank you.