Added catching of error thrown when the assembly has been rewritten but the debug symbols do not match.

This commit is contained in:
Jarl Gullberg 2017-05-30 18:16:45 +02:00
parent c05ac4f7a0
commit b8975c5626
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23

View file

@ -90,6 +90,8 @@ namespace OpenTK.Rewrite
}
// Load assembly and process all modules
try
{
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(file, read_params))
{
var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute");
@ -144,6 +146,11 @@ namespace OpenTK.Rewrite
assembly.Write(write_params);
}
}
catch (InvalidOperationException inex)
{
Console.WriteLine("Failed to load the assembly. It may already have been rewritten, and the debug symbols no longer match.");
}
}
void Rewrite(TypeDefinition type, IEnumerable<string> options)
{