Don't add compiler generated assembly attributes to satellite assemblies
authorMarek Safar <marek.safar@gmail.com>
Tue, 26 Feb 2013 15:27:58 +0000 (16:27 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 26 Feb 2013 15:27:58 +0000 (16:27 +0100)
mcs/mcs/assembly.cs
mcs/mcs/module.cs

index d86430193a8bceb18110dda6a9f87d681e75c404..fa0a61b1750a0f24b4fe91c9926baaf8d8e80b60 100644 (file)
@@ -154,6 +154,8 @@ namespace Mono.CSharp
                        }
                }
 
+               public bool IsSatelliteAssembly { get; private set; }
+
                public string Name {
                        get {
                                return name;
@@ -214,6 +216,7 @@ namespace Mono.CSharp
                                        builder_extra.SetCulture (value, a.Location);
                                }
 
+                               IsSatelliteAssembly = true;
                                return;
                        }
 
@@ -457,26 +460,28 @@ namespace Mono.CSharp
                                }
                        }
 
-                       if (!wrap_non_exception_throws_custom) {
-                               PredefinedAttribute pa = module.PredefinedAttributes.RuntimeCompatibility;
-                               if (pa.IsDefined && pa.ResolveBuilder ()) {
-                                       var prop = module.PredefinedMembers.RuntimeCompatibilityWrapNonExceptionThrows.Get ();
-                                       if (prop != null) {
-                                               AttributeEncoder encoder = new AttributeEncoder ();
-                                               encoder.EncodeNamedPropertyArgument (prop, new BoolLiteral (Compiler.BuiltinTypes, true, Location.Null));
-                                               SetCustomAttribute (pa.Constructor, encoder.ToArray ());
+                       if (!IsSatelliteAssembly) {
+                               if (!wrap_non_exception_throws_custom) {
+                                       PredefinedAttribute pa = module.PredefinedAttributes.RuntimeCompatibility;
+                                       if (pa.IsDefined && pa.ResolveBuilder ()) {
+                                               var prop = module.PredefinedMembers.RuntimeCompatibilityWrapNonExceptionThrows.Get ();
+                                               if (prop != null) {
+                                                       AttributeEncoder encoder = new AttributeEncoder ();
+                                                       encoder.EncodeNamedPropertyArgument (prop, new BoolLiteral (Compiler.BuiltinTypes, true, Location.Null));
+                                                       SetCustomAttribute (pa.Constructor, encoder.ToArray ());
+                                               }
                                        }
                                }
-                       }
 
-                       if (declarative_security != null) {
+                               if (declarative_security != null) {
 #if STATIC
-                               foreach (var entry in declarative_security) {
-                                       Builder.__AddDeclarativeSecurity (entry);
-                               }
+                                       foreach (var entry in declarative_security) {
+                                               Builder.__AddDeclarativeSecurity (entry);
+                                       }
 #else
-                               throw new NotSupportedException ("Assembly-level security");
+                                       throw new NotSupportedException ("Assembly-level security");
 #endif
+                               }
                        }
 
                        CheckReferencesPublicToken ();
index 47e9a8b82fe4bfb483e5e33adebe559980ccfd47..017664e0b356e8bcdcd36f4b541a7a5a564757be 100644 (file)
@@ -426,7 +426,7 @@ namespace Mono.CSharp
                        if (OptAttributes != null)
                                OptAttributes.Emit ();
 
-                       if (Compiler.Settings.Unsafe) {
+                       if (Compiler.Settings.Unsafe && !assembly.IsSatelliteAssembly) {
                                var pa = PredefinedAttributes.UnverifiableCode;
                                if (pa.IsDefined)
                                        pa.EmitAttribute (builder);