[Mono-bugs] [Bug 74605][Cri] New - Invalid behaviour of System.ComponentModel.Container.DefaultSite.GetService implementation (comparing to MS .NET realization)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 14 Apr 2005 05:30:17 -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 to_vitalik@ukr.net.

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

--- shadow/74605	2005-04-14 05:30:17.000000000 -0400
+++ shadow/74605.tmp.3464	2005-04-14 05:30:17.000000000 -0400
@@ -0,0 +1,56 @@
+Bug#: 74605
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: to_vitalik@ukr.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Invalid behaviour of System.ComponentModel.Container.DefaultSite.GetService implementation (comparing to MS .NET realization)
+
+Description of Problem:
+When System.ComponentModel.Container is used, components in the container 
+cannot resolve services using ISite.GetService() method because of 
+System.ComponentModel.Container.DefaultSite.GetService implementation. 
+
+
+Steps to reproduce the problem:
+1. Create System.ComponentModel.Container instance
+2. Create sample component that will call GetService(typeof(IContainer)) 
+when Site context is obtained.
+3. Add sample component to the container.
+
+Actual Results:
+GetService call returns null.
+
+Expected Results:
+GetService should return reference to the container instance.
+
+Additional Information:
+Just compare MONO and MS DefaultSite.GetService() implementations:
+----- MONO -------
+public virtual object GetService (Type t)
+{
+    if (typeof(ISite) != t) {
+	return null; // !!!!
+	}
+	return container.GetService (t);
+} 
+------- MS --------
+public object GetService(Type service)
+{
+      if (service != typeof(ISite))
+      {
+            return this.container.GetService(service);
+      }
+      return this;
+}
+------------