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 [EMAIL PROTECTED]

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

--- shadow/78517        2006-05-27 05:34:05.000000000 -0400
+++ shadow/78517.tmp.12396      2006-05-27 05:34:05.000000000 -0400
@@ -0,0 +1,98 @@
+Bug#: 78517
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: CORLIB
+AssignedTo: [EMAIL PROTECTED]                            
+ReportedBy: [EMAIL PROTECTED]               
+QAContact: [EMAIL PROTECTED]
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Assembly.LoadFrom Exceptions differ from those in MS .Net 
implementation
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem: When calling
+System.Reflection.Assembly.LoadFrom(String file) with a file which does not
+contain a valid .net assembly the funcion throws a FileNotFoundException
+where it should throw a BadImageFormatException or a FileLoadException.
+
+
+Steps to reproduce the problem:
+1. mcs Test.cs     #Test.cs is attached at the end of this text
+2. touch Testfile.dll
+3. mono Test.exe
+4. echo foobar > Testfile.dll
+5. mono Test.exe
+
+Actual Results:
+$ mcs Test.cs 
+$ touch Testfile.dll
+$ mono Test.exe
+"Testfile.dll" could not be found. Unexpected behaviour.
+$ echo foobar > Testfile.dll 
+$ mono Test.exe
+"Testfile.dll" could not be found. Unexpected behaviour.
+
+Expected Results:
+$ mcs Test.cs 
+$ touch Testfile.dll
+$ mono Test.exe
+"Testfile.dll" is empty. Expected behaviour.
+$ echo foobar > Testfile.dll 
+$ mono Test.exe
+"Testfile.dll" is not an assembly. Expected behaviour.
+
+
+How often does this happen? 
+Always
+
+
+Additional Information: Tested with both mono versions 1.1.13.6 and 1.1.15
+
+Test.cs:
+using System;
+
+namespace AssemblyTest
+{
+       class Test
+       {
+               [STAThread]
+               static void Main(string[] args)
+               {
+                       string file = "Testfile.dll";
+
+                       if(System.IO.File.Exists(file))
+                       {
+                               try
+                               {
+                                       
System.Reflection.Assembly.LoadFrom(file);
+                               }
+                               catch(BadImageFormatException)
+                               {
+                                       Console.WriteLine("\"{0}\" is not an 
assembly. Expected behaviour.",
+file);
+                               }
+                               catch(System.IO.FileLoadException)
+                               {
+                                       Console.WriteLine("\"{0}\" is empty. 
Expected behaviour.", file);
+                               }
+                               catch(System.IO.FileNotFoundException)
+                               {
+                                       Console.WriteLine("\"{0}\" could not be 
found. Unexpected behaviour.",
+file);
+                               }
+                       }
+                       else
+                               Console.WriteLine("To make the test work please 
create a file named
+\"{0}\" " +
+                                                                 "in the 
working directory of this program.", file);
+               }
+       }
+}
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to