[Mono-bugs] [Bug 49824][Nor] New - Threading.SyncronizationException thrown on calling Monitor.Exit on an object that has not been locked.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 18 Oct 2003 09:57:06 -0400 (EDT)
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 gileslforster@yahoo.co.uk.
http://bugzilla.ximian.com/show_bug.cgi?id=49824
--- shadow/49824 2003-10-18 09:57:06.000000000 -0400
+++ shadow/49824.tmp.11131 2003-10-18 09:57:06.000000000 -0400
@@ -0,0 +1,89 @@
+Bug#: 49824
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Standard Install
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gileslforster@yahoo.co.uk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Threading.SyncronizationException thrown on calling Monitor.Exit on an object that has not been locked.
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+Steps to reproduce the problem:
+
+Bellow a simple console application calling Monitor.Exit(obj) on an
+object to which Monitor.Enter(obj) has not been called.
+
+using System;
+using System.Threading;
+
+namespace ConsoleApplication
+{
+ class Class1
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Class1 x = new Class1();
+
+ Monitor.Exit(x);
+
+ Console.WriteLine("All done.");
+ }
+ }
+}
+
+Actual Results:
+
+[giles@Linux-02 Mono]$ mono ConsoleApplication.exe
+
+
+
+Unhandled Exception: System.Threading.SynchronizationLockException: Not
+locked
+
+in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x20)
+[0x400aa8e9]
+
+in (unmanaged) /usr/lib/libmono.so.0(mono_monitor_exit+0x3b) [0x400c387d]
+
+in (unmanaged) /usr/lib/libmono.so.0 [0x400c3939]
+
+in <0x0003b> System.Threading.Monitor:Exit (object)
+
+in <0x00036> ConsoleApplication.Class1:Main (string[])
+
+
+Expected Results:
+
+[giles@Linux-02 Mono]$ mono ConsoleApplication.exe
+All done.
+[giles@Linux-02 Mono]$
+
+
+How often does this happen?
+
+Always.
+
+Additional Information:
+
+Under .NET 1.1 on Windows the default behaviour is to ignore the fact
+that Enter() has not been called if calling Exit() on an unlocked object
+for the current thread. On Mono it throws a SynchronizationLockException,
+leading to incompatible code. Not sure what the ECMA standard says but
+don't know where to look.
+
+Thanks,
+
+Giles