[Mono-bugs] [Bug 82848][Nor] New - GCHandle.AddrOfPinnedObject() exception instead of returning a value.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Sep 14 05:00:22 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dragon at pksoft.hu.
http://bugzilla.ximian.com/show_bug.cgi?id=82848
--- shadow/82848 2007-09-14 05:00:22.000000000 -0400
+++ shadow/82848.tmp.2136 2007-09-14 05:00:22.000000000 -0400
@@ -0,0 +1,53 @@
+Bug#: 82848
+Product: Mono: Class Libraries
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: dragon at pksoft.hu
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: GCHandle.AddrOfPinnedObject() exception instead of returning a value.
+
+Description of Problem:
+GCHandle.AddrOfPinnedObject() throws exception if it has been allocated for
+an object with a value of null.
+
+
+Steps to reproduce the problem:
+Use the following code:
+
+object nullObj = null;
+GCHandle handle = GCHandle.Alloc(nullObj, GCHandleType.Pinned);
+try
+{
+ IntPtr ptr = handle.AddrOfPinnedObject();
+ Console.WriteLine(ptr);
+}
+finally
+{
+ handle.Free();
+}
+
+Actual Results:
+Unhandled Exception: System.InvalidOperationException: The handle is not of
+Pinned type
+ at System.Runtime.InteropServices.GCHandle.AddrOfPinnedObject () [0x00000]
+
+Expected Results:
+The variable gets a value of zero. "0" gets printed onto screen.
+
+
+How often does this happen?
+Always
+
+Additional Information:
+Happens with Mono 1.2.5. Shows expected results on MS .Net 2.0.
+Untested under Linux.
More information about the mono-bugs
mailing list