Browse Source

Fix #1570: Handle ReflectionNameParseException when decoding invalid attribute arguments

pull/1596/head
Daniel Grunwald 6 years ago
parent
commit
dec9c83c4c
  1. 8
      ICSharpCode.Decompiler/TypeSystem/TypeProvider.cs

8
ICSharpCode.Decompiler/TypeSystem/TypeProvider.cs

@ -141,8 +141,12 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -141,8 +141,12 @@ namespace ICSharpCode.Decompiler.TypeSystem
if (name == null) {
return null;
}
return ReflectionHelper.ParseReflectionName(name)
.Resolve(module != null ? new SimpleTypeResolveContext(module) : new SimpleTypeResolveContext(compilation));
try {
return ReflectionHelper.ParseReflectionName(name)
.Resolve(module != null ? new SimpleTypeResolveContext(module) : new SimpleTypeResolveContext(compilation));
} catch (ReflectionNameParseException ex) {
throw new BadImageFormatException($"Invalid type name: \"{name}\": {ex.Message}");
}
}
public IType GetTypeFromSpecification(SRM.MetadataReader reader, GenericContext genericContext, SRM.TypeSpecificationHandle handle, byte rawTypeKind)

Loading…
Cancel
Save