2006-12-01 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / System / System.CodeDom.Compiler / CompilerResults.cs
index 35072729eed24315c6ed0dd034f36f98ea20609b..0c5143e5a79a8835ce4b447c4090e5cd24b15ff9 100644 (file)
@@ -6,8 +6,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2002 Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Collections.Specialized;
+using System.Reflection;
+using System.Security.Permissions;
 using System.Security.Policy;
 
-namespace System.CodeDom.Compiler
-{
-       using System.Reflection;
-       using System.Collections.Specialized;
+namespace System.CodeDom.Compiler {
+
+#if NET_2_0
+       [Serializable]
+#endif
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
+       public class CompilerResults {
 
-       public class CompilerResults
-       {
                private Assembly compiledAssembly;
                private CompilerErrorCollection errors = new CompilerErrorCollection ();
-               #if (NET_1_1)
-                       private Evidence evidence;
-               #endif
+#if NET_1_1
+               private Evidence evidence;
+#endif
                private int nativeCompilerReturnValue = 0;
                private StringCollection output = new StringCollection ();
                private string pathToAssembly;
@@ -61,6 +65,8 @@ namespace System.CodeDom.Compiler
                //
                public Assembly CompiledAssembly {
                        get {
+                               if ((compiledAssembly == null) && (pathToAssembly != null))
+                                       compiledAssembly = Assembly.LoadFrom (pathToAssembly);
                                return compiledAssembly;
                        }
                        set {
@@ -76,16 +82,13 @@ namespace System.CodeDom.Compiler
                        }
                }
 
-               #if (NET_1_1)
+#if NET_1_1
                public Evidence Evidence {
-                       get {
-                               return evidence;
-                       }
-                       set {
-                               evidence = value;
-                       }
+                       get { return evidence; }
+                       [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
+                       set { evidence = value; }
                }
-               #endif
+#endif
 
                public int NativeCompilerReturnValue {
                        get {