[Mono-bugs] [Bug 71651][Nor] New - Security attributes exceptions aren't catch by mcs

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 23 Jan 2005 21:29:39 -0500 (EST)

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 sebastien@ximian.com.


--- shadow/71651	2005-01-23 21:29:39.000000000 -0500
+++ shadow/71651.tmp.7098	2005-01-23 21:29:39.000000000 -0500
@@ -0,0 +1,80 @@
+Bug#: 71651
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Security attributes exceptions aren't catch by mcs
+Description of Problem:
+Security attributes can throw exception if some properties are invalid.
+Compilers for 1.0/1.1 (see notes) should catch any exception and report
+them as a CS0647 error (or language equivalent error).
+Steps to reproduce the problem:
+1. Compile the following code
+using System;
+using System.Security.Permissions;
+public class Program {
+	[FileIOPermission (SecurityAction.Demand, PathDiscovery="C:\\")]
+	static public int Main (string[] args)
+	{
+		return 0;
+	}
+2. Compile with MCS
+Actual Results:
+Unhandled Exception: System.ArgumentException: Absolute path information is
+Parameter name: path
+in <0x000b4>
+System.Security.Permissions.FileIOPermission:ThrowIfInvalidPath (string)
+in <0x00032> System.Security.Permissions.FileIOPermission:AddPathList
+in <0x00089>
+System.Security.Permissions.FileIOPermissionAttribute:CreatePermission ()
+in <0x002d1> Mono.CSharp.Attribute:ExtractSecurityPermissionSet
+in <0x0016e> Mono.CSharp.Method:ApplyAttributeBuilder
+in <0x00108> Mono.CSharp.Attribute:Emit
+in <0x000ba> Mono.CSharp.Attributes:Emit
+in <0x000e9> Mono.CSharp.MethodData:Emit
+in <0x00022> Mono.CSharp.Method:Emit ()
+in <0x0058d> Mono.CSharp.TypeContainer:EmitType ()
+in <0x003f8> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c4b> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> Mono.CSharp.Driver:Main (string[])
+Expected Results:
+How often does this happen? 
+Additional Information:
+* The sample code compile correctly under Windows because the path is valid
+(for Windows). Changing the path to an invalid (windows) path, like "\\"
+would result in error CS0647.
+* This doesn't affect GMCS (or NET_2_0) as the attribute isn't evaluated by
+the compiler but only stored in the metadata.