* driver.cs (BadAssembly): Handle all the ugliness of DefineDynamicAssembly.
authorRaja R Harinath <harinath@hurrynot.org>
Thu, 9 Nov 2006 11:38:53 +0000 (11:38 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Thu, 9 Nov 2006 11:38:53 +0000 (11:38 -0000)
svn path=/trunk/mcs/; revision=67588

mcs/mcs/ChangeLog
mcs/mcs/driver.cs

index 31343300392dd7cbdbaa17cd3e29d47e55bf6aec..9baf14e9388813a6d3123a323e1da1c52e06d35a 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-09  Raja R Harinath  <rharinath@novell.com>
+
+       * driver.cs (BadAssembly): Handle all the ugliness of
+       DefineDynamicAssembly.
+
 2006-11-08  Raja R Harinath  <rharinath@novell.com>
 
        Address parts of #58244 -- most of what's left is in the runtime
index ec82e7fefc712016d394f72b7d6dd9714471ecb7..f26d5ab081ec20cf986f138991f9c305c39a450d 100644 (file)
@@ -336,9 +336,24 @@ namespace Mono.CSharp
                                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);