[Mono-bugs] [Bug 335601] New: [MethodImpl(MethodImplOptions.Synchronized)] don' t work with virtual method

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 22 06:31:54 EDT 2007


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: mono-bugs at ximian.com
        ReportedBy: informatique.internet at fiducial.fr
         QAContact: mono-bugs at ximian.com
          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.


More information about the mono-bugs mailing list