Browse Source

Fix #1372: XML security attributes are not added to the output.

pull/1405/head
Siegfried Pammer 7 years ago
parent
commit
1863174f8e
  1. 5
      ICSharpCode.Decompiler/TypeSystem/Implementation/AttributeListBuilder.cs
  2. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/KnownAttributes.cs

5
ICSharpCode.Decompiler/TypeSystem/Implementation/AttributeListBuilder.cs

@ -245,16 +245,17 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -245,16 +245,17 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
} else {
// for backward compatibility with .NET 1.0: XML-encoded attribute
reader.Reset();
ReadXmlSecurityAttribute(ref reader, securityAction);
Add(ReadXmlSecurityAttribute(ref reader, securityAction));
}
}
private void ReadXmlSecurityAttribute(ref SRM.BlobReader reader, CustomAttributeTypedArgument<IType> securityAction)
private IAttribute ReadXmlSecurityAttribute(ref SRM.BlobReader reader, CustomAttributeTypedArgument<IType> securityAction)
{
string xml = reader.ReadUTF16(reader.RemainingBytes);
var b = new AttributeBuilder(module, KnownAttribute.PermissionSet);
b.AddFixedArg(securityAction);
b.AddNamedArg("XML", KnownTypeCode.String, xml);
return b.Build();
}
private IAttribute ReadBinarySecurityAttribute(ref SRM.BlobReader reader, CustomAttributeTypedArgument<IType> securityAction)

2
ICSharpCode.Decompiler/TypeSystem/Implementation/KnownAttributes.cs

@ -144,7 +144,7 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -144,7 +144,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
// Marshalling attributes:
new TopLevelTypeName("System.Runtime.InteropServices", nameof(MarshalAsAttribute)),
// Security attributes:
new TopLevelTypeName("System.Security", "PermissionSetAttribute"),
new TopLevelTypeName("System.Security.Permissions", "PermissionSetAttribute"),
};
public static ref readonly TopLevelTypeName GetTypeName(this KnownAttribute attr)

Loading…
Cancel
Save