[Mono-bugs] [Bug 79661][Nor] New - [PATCH] Improve exception reported for invalid IL images

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Oct 14 10:05:27 EDT 2006


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 gert.driesen at pandora.be.

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

--- shadow/79661	2006-10-14 10:05:27.000000000 -0400
+++ shadow/79661.tmp.19393	2006-10-14 10:05:27.000000000 -0400
@@ -0,0 +1,48 @@
+Bug#: 79661
+Product: Mono: Runtime
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] Improve exception reported for invalid IL images
+
+The attached patches contain exception improvements for both runtime and 
+corlib when an invalid IL image is loaded.
+
+Runtime:
+* appdomain.c: Use mono_get_exception_bad_image_format2 to construct
+BadImageFormatException in ves_icall_System_Reflection_Assembly_LoadFrom
+when fname does not refer to valid assembly. This result in a more
+meaningful error message.
+* exception.c: added mono_get_exception_bad_image_format2 which 
+constructs a BadImageFormatException using the ctor taking a custom
+message and the file name. Passing in a NULL msg results in a default
+message.
+* exception.h: define mono_get_exception_bad_image_format2 function.
+* icall.c: in InternalGetAssemblyName, throw BadImageFormatException 
+when file name pointed to an invalid IL image. Use 
+mono_get_exception_file_not_found2 to construct FileNotFoundException,
+as this results in a more meaningful error message.
+
+Corlib:
+* BadImageFormatException.cs: Changed message for default ctor to
+match MS. Use internal message field of Exception to check whether
+Message is null. Match MS default messages when no message is 
+set. Fixed ToString to match MS.
+* AssemblyName.cs: No need to convert filename to absolute path before
+passing it to Assembly.InternalGetAssemblyName. This allows our
+exception messages to be better match those of MS.
+* BadImageFormatExceptionTest.cs: Added ctors tests.
+* corlib_test.dll.sources: Added BadImageFormatExceptionTest.cs.
+
+Let me know if it's ok commit.


More information about the mono-bugs mailing list