[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    [Mono-dev] patch for System.ComponentModel.Container
From:       Jackson Harper <jackson () ximian ! com>
Date:       2006-01-31 22:25:04
Message-ID: 1138749871.7946.55.camel () 3(NXDOMAIN)
[Download RAW message or body]

Attached is a test case that shows a bug in
System.ComponentModel.Container, it looks like the type check in
DefaultSite.GetService is the culprit does anyone have problems with the
attached patch?

With this patch I'm able to run nunit-gui with our winforms, without it
it crashes on startup.

Thanks,
Jackson



["System.ComponentModel.Container.patch" (System.ComponentModel.Container.patch)]

Index: System.ComponentModel/Container.cs
===================================================================
--- System.ComponentModel/Container.cs	(revision 56090)
+++ System.ComponentModel/Container.cs	(working copy)
@@ -102,9 +102,6 @@
 
 			public virtual object GetService (Type t)
 			{
-				if (typeof(ISite) != t) {
-					return null; 
-				}
 				return container.GetService (t);
 			}
 		}

["container.cs" (container.cs)]

using System;
using System.Windows.Forms;
using System.ComponentModel;

public class T :Form {

	public class TestService {

	}

	public class TestContainer : Container {

		protected override object GetService (Type service)
		{
			if (service == typeof (TestService))
				return "TEST SERVICE";
			return base.GetService (service);
		}
	}

	public static void Main ()
	{
		Container cnt = new TestContainer ();
		T t = new T ();
		cnt.Add (t, null);
		Console.WriteLine ("service:  " + t.GetService (typeof (TestService)));
	}
}



_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic