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.
There was some discussion in bug http://bugzilla.novell.com/583901 about if the bug belonged to the runtime or not.
The culprit was really a missing [UnmanagedFunctionPointer] attribute, but the fact that MS.NET and mono runtime differ when dealing with this problem is a bug in itself which obscures things: Mono should raise an AccessViolationException like MS.NET does, instead of a plain unmanaged exception.
If I understand correctly, this is about converting unmanaged crashes into AccessViolationExceptions ? We don't do that, and probably never will, crashes in unmanaged code are not exceptions, and shouldn't be converted to it.
(In reply to comment #1)
> If I understand correctly, this is about converting unmanaged crashes into
> AccessViolationExceptions ?
I didn't intend to create such a broad bug. The scenario here is just about a missing attribute in a P/Invoke delegate, not sure if MS.NET throws AccessViolationException for every single unmanaged crash.
> We don't do that, and probably never will, crashes
> in unmanaged code are not exceptions, and shouldn't be converted to it.
Why does MS.NET do it then (at least in this specific case)? And why wouldn't you want to mimic their behaviour? In this specific case it is a good thing because it gives clues that the problem is indeed in the managed code (because it's the one you need to modify to prevent the unmanaged call to crash).
AccessViolationException is a generic exception which is thrown when something SIGSEGV like happens on windows. If they do indeed check for a calling conv mismatch, then they would throw a precise exception, so this is probably by accident.