Browse Source

Merge pull request #875 from mohe2015/fix-assembly-resolution

Don't crash if assembly resolution fails.
pull/876/merge
Daniel Grunwald 8 years ago committed by GitHub
parent
commit
9faeb9d680
  1. 5
      ICSharpCode.Decompiler.Console/CustomAssemblyResolver.cs
  2. 2
      ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs

5
ICSharpCode.Decompiler.Console/CustomAssemblyResolver.cs

@ -52,6 +52,7 @@ namespace ICSharpCode.Decompiler.Console @@ -52,6 +52,7 @@ namespace ICSharpCode.Decompiler.Console
public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
{
try {
var targetFramework = TargetFramework.Split(new[] { ",Version=v" }, StringSplitOptions.None);
string file = null;
switch (targetFramework[0]) {
@ -77,6 +78,10 @@ namespace ICSharpCode.Decompiler.Console @@ -77,6 +78,10 @@ namespace ICSharpCode.Decompiler.Console
default:
return base.Resolve(name, parameters);
}
} catch (AssemblyResolutionException exception) {
System.Console.WriteLine(exception.ToString());
return null;
}
}
}
}

2
ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs

@ -301,7 +301,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -301,7 +301,7 @@ namespace ICSharpCode.Decompiler.CSharp
string dir = CleanUpFileName(type.Namespace);
if (directories.Add(dir))
Directory.CreateDirectory(Path.Combine(targetDirectory, dir));
return Path.Combine(targetDirectory, dir, file);
return Path.Combine(dir, file);
}
}, StringComparer.OrdinalIgnoreCase).ToList();
DecompilerTypeSystem ts = new DecompilerTypeSystem(module);

Loading…
Cancel
Save