Author: spouliot
Date: 2007-03-14 10:46:46 -0500 (Wed, 14 Mar 2007)
New Revision: 74263

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs
Log:
2007-03-14  Ivan N. Zlatev  <[EMAIL PROTECTED]>

        * ToolboxItem.cs: Fixed GetType not to be
        dependant on ITypeResolutionService.



Modified: trunk/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog      
2007-03-14 15:29:56 UTC (rev 74262)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog      
2007-03-14 15:46:46 UTC (rev 74263)
@@ -1,3 +1,8 @@
+2007-03-14  Ivan N. Zlatev  <[EMAIL PROTECTED]>
+
+       * ToolboxItem.cs: Fixed GetType not to be
+       dependant on ITypeResolutionService.
+
 2007-03-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * ToolboxItem.cs: Normalize line endings.

Modified: trunk/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs 
2007-03-14 15:29:56 UTC (rev 74262)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs 
2007-03-14 15:46:46 UTC (rev 74263)
@@ -251,15 +251,20 @@
                                return null;
 
                        //get ITypeResolutionService from host, as we have no 
other IServiceProvider here
-                       ITypeResolutionService typeRes = 
host.GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
-                       if (typeRes == null)
-                               throw new Exception("Host does not provide an 
ITypeResolutionService");
-
-                       //TODO: Using Assembly loader to throw errors. Silent 
fail and return null?
-                       typeRes.GetAssembly(assemblyName, true);
-                       if (reference)
-                               typeRes.ReferenceAssembly(assemblyName);
-                       return typeRes.GetType(typeName, true);
+                       ITypeResolutionService typeRes = host.GetService 
(typeof (ITypeResolutionService)) as ITypeResolutionService;
+                       Type type = null;
+                       if (typeRes != null) {
+                               //TODO: Using Assembly loader to throw errors. 
Silent fail and return null?
+                               typeRes.GetAssembly (assemblyName, true);
+                               if (reference)
+                                       typeRes.ReferenceAssembly 
(assemblyName);
+                               type = typeRes.GetType (typeName, true);
+                       } else {
+                               Assembly assembly = Assembly.Load 
(assemblyName);
+                               if (assembly != null)
+                                       type = assembly.GetType (typeName);
+                       }
+                       return type;
                }
 
                // FIXME - Should we be returning empty bitmap, or null?

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to