Browse Source

Go to .3447 Nuget (found .deps.json parsing error on release tests). That also hid a throw on assembly resolution.

pull/1010/head
Christoph Wille 8 years ago
parent
commit
8bb5551396
  1. 2
      DecompilerNuGetDemos.workbook
  2. 2
      ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
  3. 9
      ICSharpCode.Decompiler.Console/Program.cs
  4. 6
      ICSharpCode.Decompiler.PowerShell/Demo.ps1
  5. 4
      ICSharpCode.Decompiler.PowerShell/GetDecompilerCmdlet.cs
  6. 2
      ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj

2
DecompilerNuGetDemos.workbook

@ -6,7 +6,7 @@ platforms:
- DotNetCore - DotNetCore
packages: packages:
- id: ICSharpCode.Decompiler - id: ICSharpCode.Decompiler
version: 3.0.0.3443 version: 3.0.0.3447
--- ---
Setup: load the references required to work with the decompiler Setup: load the references required to work with the decompiler

2
ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj

@ -14,7 +14,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.0.1" /> <PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.0.1" />
<PackageReference Include="ICSharpCode.Decompiler" Version="3.0.0.3443" /> <PackageReference Include="ICSharpCode.Decompiler" Version="3.0.0.3447" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" /> <PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" /> <PackageReference Include="System.Runtime.Handles" Version="4.3.0" />

9
ICSharpCode.Decompiler.Console/Program.cs

@ -75,9 +75,14 @@ namespace ICSharpCode.Decompiler.Console
return app.Execute(args); return app.Execute(args);
} }
static CSharpDecompiler GetDecompiler(string assemblyFileName)
{
return new CSharpDecompiler(assemblyFileName, new DecompilerSettings() { ThrowOnAssemblyResolveErrors = false });
}
static void ListContent(string assemblyFileName, TextWriter output, ISet<TypeKind> kinds) static void ListContent(string assemblyFileName, TextWriter output, ISet<TypeKind> kinds)
{ {
CSharpDecompiler decompiler = new CSharpDecompiler(assemblyFileName, new DecompilerSettings()); CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
foreach (var type in decompiler.TypeSystem.Compilation.MainAssembly.GetAllTypeDefinitions()) { foreach (var type in decompiler.TypeSystem.Compilation.MainAssembly.GetAllTypeDefinitions()) {
if (!kinds.Contains(type.Kind)) if (!kinds.Contains(type.Kind))
@ -95,7 +100,7 @@ namespace ICSharpCode.Decompiler.Console
static void Decompile(string assemblyFileName, TextWriter output, string typeName = null) static void Decompile(string assemblyFileName, TextWriter output, string typeName = null)
{ {
CSharpDecompiler decompiler = new CSharpDecompiler(assemblyFileName, new DecompilerSettings()); CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
if (typeName == null) { if (typeName == null) {
output.Write(decompiler.DecompileWholeModuleAsString()); output.Write(decompiler.DecompileWholeModuleAsString());

6
ICSharpCode.Decompiler.PowerShell/Demo.ps1

@ -10,7 +10,11 @@ Import-Module $modulePath
$version = Get-DecompilerVersion $version = Get-DecompilerVersion
Write-Output $version Write-Output $version
$decompiler = Get-Decompiler $modulePath # different test assemblies - it makes a difference wrt .deps.json so there are two netstandard tests here
$asm_netstdWithDepsJson = $basePath + '\bin\Debug\netstandard2.0\ICSharpCode.Decompiler.Powershell.dll'
$asm_netstd = $basePath + '\bin\Debug\netstandard2.0\ICSharpCode.Decompiler.dll'
$decompiler = Get-Decompiler $asm_netstdWithDepsJson
$classes = Get-DecompiledTypes $decompiler -Types class $classes = Get-DecompiledTypes $decompiler -Types class
$classes.Count $classes.Count

4
ICSharpCode.Decompiler.PowerShell/GetDecompilerCmdlet.cs

@ -20,7 +20,9 @@ namespace ICSharpCode.Decompiler.PowerShell
string path = GetUnresolvedProviderPathFromPSPath(LiteralPath); string path = GetUnresolvedProviderPathFromPSPath(LiteralPath);
try { try {
var decompiler = new CSharpDecompiler(path, new DecompilerSettings()); var decompiler = new CSharpDecompiler(path, new DecompilerSettings() {
ThrowOnAssemblyResolveErrors = false
});
WriteObject(decompiler); WriteObject(decompiler);
} catch (Exception e) { } catch (Exception e) {

2
ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj

@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="PowerShellStandard.Library" Version="3.0.0-preview-01" /> <PackageReference Include="PowerShellStandard.Library" Version="3.0.0-preview-01" />
<PackageReference Include="ICSharpCode.Decompiler" Version="3.0.0.3443" /> <PackageReference Include="ICSharpCode.Decompiler" Version="3.0.0.3447" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Loading…
Cancel
Save