[Mono-bugs] [Bug 426181] New: System.AccessViolation Doesn' t Contain The Same Private Fields As MS .NET

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Sep 14 18:01:27 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=426181


           Summary: System.AccessViolation Doesn't Contain The Same Private
                    Fields As MS .NET
           Product: Mono: Class Libraries
           Version: 1.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: martin_costello at talk21.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer


Created an attachment (id=239453)
 --> (https://bugzilla.novell.com/attachment.cgi?id=239453)
Example for getting private fields via reflection

Viewing the source for AccessViolation, the only field in the class is:

const int Result = unchecked ((int)0x80004003);

However, the Microsoft implementation also has fields for the fault address,
accessed memory address, and whether the access was read or write.  These
private fields can be seen when using MS Visual Studio with the debugger
running.

In some of my own code that uses P/Invoke, I have an exception handling class
that uses reflection to get the value of these fields to help diagnose crashes
in the library being loaded via P/Invoke.  The attachment shows how this is
achieved.

If the Mono implementation is different, this code is doomed to failure.  Due
to it's use of reflection, this wasn't spotted by MoMA, and only noticed at a
cursory glance at the class.

The Mono implementation of AccessViolationException should decalre these fields
in the same order as MS's, even if they cannot be set to anything meaningful.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list