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

           Summary: [MethodImpl(MethodImplOptions.Synchronized)] don't work
                    with virtual method
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [EMAIL PROTECTED]
          Found By: ---


I'm using mono from svn... I'm trying to use the SharpSSH library but it failed
with some : System.Threading.SynchronizationLockException: Object is not
synchronized


After more investigation i've find this problem :

this program :
using System;
using System.Threading;
using System.Runtime.CompilerServices;

namespace TestLocks
{
        class MainClass
        {
                public static void Main(string[] args)
                {
                        MainClass MainClassInstance=new MainClass();
                        MainClassInstance.LockMethod();
                }

                [MethodImpl(MethodImplOptions.Synchronized)]
                public virtual void LockMethod()
                {
                        Monitor.PulseAll(this);
                        Console.WriteLine("Hello World!");
                }
        }
}

don't work and fails with Unhandled Exception:
System.Threading.SynchronizationLockException: Object is not synchronized

and this program :
using System;
using System.Threading;
using System.Runtime.CompilerServices;

namespace TestLocks
{
        class MainClass
        {
                public static void Main(string[] args)
                {
                        MainClass MainClassInstance=new MainClass();
                        MainClassInstance.LockMethod();
                }

                [MethodImpl(MethodImplOptions.Synchronized)]
                public void LockMethod()
                {
                        Monitor.PulseAll(this);
                        Console.WriteLine("Hello World!");
                }
        }
}

work well...

It seems there's a problem with [MethodImpl(MethodImplOptions.Synchronized)] on
virtual method...


-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to