[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.
http://bugzilla.ximian.com/show_bug.cgi?id=71651
--- 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
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sebastien@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+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
+required.
+Parameter name: path
+in <0x000b4>
+System.Security.Permissions.FileIOPermission:ThrowIfInvalidPath (string)
+in <0x00032> System.Security.Permissions.FileIOPermission:AddPathList
+(System.Security.Permissions.FileIOPermissionAccess,string)
+in <0x00089>
+System.Security.Permissions.FileIOPermissionAttribute:CreatePermission ()
+in <0x002d1> Mono.CSharp.Attribute:ExtractSecurityPermissionSet
+(System.Collections.Specialized.ListDictionary)
+in <0x0016e> Mono.CSharp.Method:ApplyAttributeBuilder
+(Mono.CSharp.Attribute,System.Reflection.Emit.CustomAttributeBuilder)
+in <0x00108> Mono.CSharp.Attribute:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable,System.Collections.Specialized.ListDictionary)
+in <0x000ba> Mono.CSharp.Attributes:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable)
+in <0x000e9> Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Attributable)
+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:
+CS0647
+
+How often does this happen?
+Always
+
+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.