Browse Source

Avoid crash with duplicate named arguments to attributes (obfuscated assembly?) - http://community.sharpdevelop.net/forums/t/12181.aspx

pull/12/head
Daniel Grunwald 15 years ago
parent
commit
cfeb306c48
  1. 4
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs

4
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs

@ -56,7 +56,9 @@ namespace ICSharpCode.SharpDevelop.Dom
a.PositionalArguments.Add(GetValue(pc, member, argument)); a.PositionalArguments.Add(GetValue(pc, member, argument));
} }
foreach (CustomAttributeNamedArgument entry in att.Properties) { foreach (CustomAttributeNamedArgument entry in att.Properties) {
a.NamedArguments.Add(entry.Name, GetValue(pc, member, entry.Argument)); // some obfuscated assemblies may contain duplicate named arguments; we'll have to ignore those
if (!a.NamedArguments.ContainsKey(entry.Name))
a.NamedArguments.Add(entry.Name, GetValue(pc, member, entry.Argument));
} }
} catch (InvalidOperationException) { } catch (InvalidOperationException) {
// Workaround for Cecil bug. (some types cannot be resolved) // Workaround for Cecil bug. (some types cannot be resolved)

Loading…
Cancel
Save