[Mono-bugs] [Bug 79059][Nor] New - UnixRegistryAPI: ObjectDisposedException using DeleteSubKeyTree

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Aug 11 04:56:55 EDT 2006


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 gert.driesen at pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=79059

--- shadow/79059	2006-08-11 04:56:55.000000000 -0400
+++ shadow/79059.tmp.32301	2006-08-11 04:56:55.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 79059
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: UnixRegistryAPI: ObjectDisposedException using DeleteSubKeyTree
+
+When two RegistryKey instances referring to the same registry key are 
+instantiated, and one if disposed then an ObjectDisposedException is 
+reported when attempting to remove a subkey tree from the second instance.
+
+To reproduce, compile and run the following code snippet:
+
+using Microsoft.Win32;
+
+public class EntryPoint {
+  static void Main () {
+    using (RegistryKey key1 = Registry.LocalMachine.OpenSubKey 
+("software", true)) {
+      RegistryKey key2 = key1.CreateSubKey ("test");
+      using (RegistryKey key4 = Registry.LocalMachine.OpenSubKey 
+("software")) {
+      }
+      key2.Close ();
+      key1.DeleteSubKeyTree ("test");
+    }
+  }
+}
+
+Expected result:
+
+No failure
+
+Actual result:
+
+Unhandled Exception: System.ObjectDisposedException: The object was used 
+after being disposed.
+  at Microsoft.Win32.RegistryKey.AssertKeyStillValid () [0x00000] 
+  at Microsoft.Win32.RegistryKey.DeleteSubKeyTree (System.String keyName) 
+[0x00000] 
+  at (wrapper remoting-invoke-with-check) 
+Microsoft.Win32.RegistryKey:DeleteSubKeyTree (string)
+  at EntryPoint.Main () [0x00000]


More information about the mono-bugs mailing list