diff options
author | Jeroen Frijters <jeroen@frijters.net> | 2013-09-22 11:44:00 +0400 |
---|---|---|
committer | Jeroen Frijters <jeroen@frijters.net> | 2013-09-22 11:44:00 +0400 |
commit | 3575667a2da2ee84c05d62d1c0dc6fb18d76fc8f (patch) | |
tree | 958681e12c14332a29a844e377e444fc87750e60 /Disassembler.cs | |
parent | 57ab0b490a4de82b1cc0816db53153ab4cae1086 (diff) |
Fixed DebuggableAttribute detection.
Diffstat (limited to 'Disassembler.cs')
-rw-r--r-- | Disassembler.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Disassembler.cs b/Disassembler.cs index b34a36f..01caa6b 100644 --- a/Disassembler.cs +++ b/Disassembler.cs @@ -2103,8 +2103,7 @@ namespace Ildasm } foreach (var ca in cas) { - if (ca.Constructor.DeclaringType.FullName == "System.Diagnostics.DebuggableAttribute" - && ca.Constructor.DeclaringType.Assembly.GetName().Name == "mscorlib") + if (compat != CompatLevel.None && IsDebuggableAttribute(ca.AttributeType)) { lw.WriteLine(); lw.WriteLine(" // --- The following custom attribute is added automatically, do not uncomment -------"); @@ -2150,6 +2149,16 @@ namespace Ildasm lw.WriteLine("}"); } + static bool IsDebuggableAttribute(Type type) + { + return !type.IsNested + && (type.__IsMissing || !type.IsGenericType) + && !type.HasElementType + && !type.__IsFunctionPointer + && type.__Name == "DebuggableAttribute" + && type.__Namespace == "System.Diagnostics"; + } + void WriteDeclarativeSecurity(LineWriter lw, int level, IList<CustomAttributeData> list, int metadataToken) { var action = (System.Security.Permissions.SecurityAction)(- 1); |