Author: raja
Date: 2006-11-09 06:38:53 -0500 (Thu, 09 Nov 2006)
New Revision: 67588

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/driver.cs
Log:
* driver.cs (BadAssembly): Handle all the ugliness of DefineDynamicAssembly.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2006-11-09 11:03:17 UTC (rev 67587)
+++ trunk/mcs/mcs/ChangeLog     2006-11-09 11:38:53 UTC (rev 67588)
@@ -1,3 +1,8 @@
+2006-11-09  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * driver.cs (BadAssembly): Handle all the ugliness of
+       DefineDynamicAssembly.
+
 2006-11-08  Raja R Harinath  <[EMAIL PROTECTED]>
 
        Address parts of #58244 -- most of what's left is in the runtime

Modified: trunk/mcs/mcs/driver.cs
===================================================================
--- trunk/mcs/mcs/driver.cs     2006-11-09 11:03:17 UTC (rev 67587)
+++ trunk/mcs/mcs/driver.cs     2006-11-09 11:38:53 UTC (rev 67588)
@@ -336,9 +336,24 @@
                                AssemblyName an = new AssemblyName ();
                                an.Name = ".temp";
                                AssemblyBuilder ab = 
AppDomain.CurrentDomain.DefineDynamicAssembly (an, AssemblyBuilderAccess.Run);
-                               if (adder_method.Invoke (ab, new object [] { 
filename }) != null) {
-                                       Report.Error (1509, "referenced file 
`{0}' is not an assembly; try using the '-addmodule' option", filename);
-                                       return;
+                               try {
+                                       object m = null;
+                                       try {
+                                               m = adder_method.Invoke (ab, 
new object [] { filename });
+                                       } catch (TargetInvocationException ex) {
+                                               throw ex.InnerException;
+                                       }
+
+                                       if (m != null) {
+                                               Report.Error (1509, "referenced 
file `{0}' is not an assembly; try using the '-addmodule' option", filename);
+                                               return;
+                                       }
+                               } catch (FileNotFoundException) {
+                                       // did the file get deleted during 
compilation? who cares? swallow the exception
+                               } catch (BadImageFormatException) {
+                                       // swallow exception
+                               } catch (FileLoadException) {
+                                       // swallow exception
                                }
                        }
                        Error9 ("assembly", filename, log);

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

Reply via email to