Browse Source

Merge branch 'master' of github.com:icsharpcode/ILSpy into string-interpolation

# Conflicts:
#	ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
pull/1012/head
Siegfried Pammer 9 years ago
parent
commit
fdb1991faa
  1. 8
      BuildTools/appveyor-install.ps1
  2. 9
      BuildTools/update-assemblyinfo.ps1
  3. 2
      DecompilerNuGetDemos.workbook
  4. 2
      ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
  5. 9
      ICSharpCode.Decompiler.Console/Program.cs
  6. 6
      ICSharpCode.Decompiler.PowerShell/Demo.ps1
  7. 4
      ICSharpCode.Decompiler.PowerShell/GetDecompilerCmdlet.cs
  8. 2
      ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj
  9. 2
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  10. 3
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  11. 75
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  12. 14
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncMain.cs
  13. 209
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncMain.opt.roslyn.il
  14. 237
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncMain.roslyn.il
  15. 31
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS72_PrivateProtected.cs
  16. 83
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS72_PrivateProtected.opt.roslyn.il
  17. 86
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS72_PrivateProtected.roslyn.il
  18. 15
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs
  19. 12
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.il
  20. 12
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.il
  21. 45
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il
  22. 50
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il
  23. 6
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  24. 6
      ICSharpCode.Decompiler/CSharp/CallBuilder.cs
  25. 19
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs
  26. 2
      ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs
  27. 3
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
  28. 3
      ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs
  29. 12
      ICSharpCode.Decompiler/DecompilerSettings.cs
  30. 6
      ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs
  31. 4
      ICSharpCode.Decompiler/DotNetCore/DotNetCorePathFinder.cs
  32. 15
      ICSharpCode.Decompiler/DotNetCore/DotNetCorePathFinderExtensions.cs
  33. 4
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  34. 3
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.nuspec.template
  35. 6
      ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs
  36. 2
      ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs
  37. 3
      ICSharpCode.Decompiler/Output/TextTokenWriter.cs
  38. 2
      ICSharpCode.Decompiler/TypeSystem/Accessibility.cs
  39. 2
      ICSharpCode.Decompiler/TypeSystem/TypeSystemExtensions.cs
  40. 4
      ILSpy.AddIn/ILSpy.AddIn.csproj
  41. 3
      ILSpy.AddIn/source.extension.vsixmanifest
  42. 1
      ILSpy/ILSpy.csproj
  43. 1
      ILSpy/Images/AccessOverlayIcon.cs
  44. 2
      ILSpy/Images/ILSpyNewIconList.txt
  45. 4
      ILSpy/Images/Images.cs
  46. BIN
      ILSpy/Images/OverlayPrivateProtected.png
  47. 2
      ILSpy/Languages/CSharpLanguage.cs
  48. 3
      ILSpy/Languages/ILLanguage.cs
  49. 11
      ILSpy/LoadedAssembly.cs
  50. 4
      ILSpy/MainWindow.xaml.cs
  51. 1
      ILSpy/Options/DecompilerSettingsPanel.xaml
  52. 5
      ILSpy/Options/DecompilerSettingsPanel.xaml.cs
  53. 9
      ILSpy/Options/DisplaySettings.cs
  54. 2
      ILSpy/Options/DisplaySettingsPanel.xaml
  55. 6
      ILSpy/Options/DisplaySettingsPanel.xaml.cs
  56. 4
      ILSpy/Properties/AssemblyInfo.template.cs
  57. 2
      ILSpy/SearchPane.cs
  58. 19
      ILSpy/SearchStrategies.cs
  59. 2
      ILSpy/TreeNodes/Analyzer/AnalyzerEntityTreeNode.cs
  60. 2
      ILSpy/TreeNodes/AssemblyListTreeNode.cs
  61. 2
      ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
  62. 7
      ILSpy/TreeNodes/AssemblyTreeNode.cs
  63. 2
      ILSpy/TreeNodes/DerivedTypesTreeNode.cs
  64. 5
      ILSpy/TreeNodes/EventTreeNode.cs
  65. 5
      ILSpy/TreeNodes/FieldTreeNode.cs
  66. 5
      ILSpy/TreeNodes/MethodTreeNode.cs
  67. 5
      ILSpy/TreeNodes/PropertyTreeNode.cs
  68. 4
      ILSpy/TreeNodes/TypeTreeNode.cs
  69. 2
      TestPlugin/ContextMenuCommand.cs
  70. 5
      appveyor.yml
  71. 29
      preparerelease.bat

8
BuildTools/appveyor-install.ps1

@ -3,6 +3,8 @@ $ErrorActionPreference = "Stop" @@ -3,6 +3,8 @@ $ErrorActionPreference = "Stop"
$baseCommit = "d779383cb85003d6dabeb976f0845631e07bf463";
$baseCommitRev = 1;
$masterBranches = @("master", "3.0.x");
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs";
$versionParts = @{};
@ -18,10 +20,10 @@ if ($versionName -ne "null") { @@ -18,10 +20,10 @@ if ($versionName -ne "null") {
} else {
$versionName = "";
}
if ($env:APPVEYOR_REPO_BRANCH -ne 'master') {
$branch = "-$env:APPVEYOR_REPO_BRANCH";
} else {
if ($masterBranches -contains $env:APPVEYOR_REPO_BRANCH) {
$branch = "";
} else {
$branch = "-$env:APPVEYOR_REPO_BRANCH";
}
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
$suffix = "-pr$env:APPVEYOR_PULL_REQUEST_NUMBER";

9
BuildTools/update-assemblyinfo.ps1

@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
$baseCommit = "d779383cb85003d6dabeb976f0845631e07bf463";
$baseCommitRev = 1;
$masterBranches = @("master", "3.0.x");
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs";
function Test-File([string]$filename) {
@ -96,10 +98,11 @@ try { @@ -96,10 +98,11 @@ try {
$branchName = gitBranch;
$gitCommitHash = gitCommitHash;
$postfixBranchName = "";
if ($branchName -ne "master") {
if ($masterBranches -contains $branchName) {
$postfixBranchName = "";
} else {
$postfixBranchName = "-$branchName";
}
}
if ($versionName -eq "null") {
$versionName = "";

2
DecompilerNuGetDemos.workbook

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

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

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.0.1" />
<PackageReference Include="ICSharpCode.Decompiler" Version="3.0.0.3403-beta4" />
<PackageReference Include="ICSharpCode.Decompiler" Version="3.0.0.3447" />
<PackageReference Include="System.IO.FileSystem.Primitives" 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 @@ -75,9 +75,14 @@ namespace ICSharpCode.Decompiler.Console
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)
{
CSharpDecompiler decompiler = new CSharpDecompiler(assemblyFileName, new DecompilerSettings());
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
foreach (var type in decompiler.TypeSystem.Compilation.MainAssembly.GetAllTypeDefinitions()) {
if (!kinds.Contains(type.Kind))
@ -95,7 +100,7 @@ namespace ICSharpCode.Decompiler.Console @@ -95,7 +100,7 @@ namespace ICSharpCode.Decompiler.Console
static void Decompile(string assemblyFileName, TextWriter output, string typeName = null)
{
CSharpDecompiler decompiler = new CSharpDecompiler(assemblyFileName, new DecompilerSettings());
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
if (typeName == null) {
output.Write(decompiler.DecompileWholeModuleAsString());

6
ICSharpCode.Decompiler.PowerShell/Demo.ps1

@ -10,7 +10,11 @@ Import-Module $modulePath @@ -10,7 +10,11 @@ Import-Module $modulePath
$version = Get-DecompilerVersion
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.Count

4
ICSharpCode.Decompiler.PowerShell/GetDecompilerCmdlet.cs

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

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

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

2
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -187,7 +187,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -187,7 +187,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var preprocessorSymbols = GetPreprocessorSymbols(flags);
if (flags.HasFlag(CompilerOptions.UseRoslyn)) {
var parseOptions = new CSharpParseOptions(preprocessorSymbols: preprocessorSymbols.ToArray());
var parseOptions = new CSharpParseOptions(preprocessorSymbols: preprocessorSymbols.ToArray(), languageVersion: LanguageVersion.Latest);
var syntaxTrees = sourceFileNames.Select(f => SyntaxFactory.ParseSyntaxTree(File.ReadAllText(f), parseOptions, path: f));
var compilation = CSharpCompilation.Create(Path.GetFileNameWithoutExtension(sourceFileName),
syntaxTrees, defaultReferences.Value,

3
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
@ -62,6 +63,8 @@ @@ -62,6 +63,8 @@
<Compile Include="TestCases\Correctness\MiniJSON.cs" />
<Compile Include="TestCases\Correctness\FloatingPointArithmetic.cs" />
<Compile Include="TestCases\ILPretty\Issue982.cs" />
<Compile Include="TestCases\Pretty\AsyncMain.cs" />
<Compile Include="TestCases\Pretty\CS72_PrivateProtected.cs" />
<Compile Include="TestCases\Pretty\CS6_StringInterpolation.cs" />
<Compile Include="TestCases\Pretty\ExpressionTrees.cs" />
<Compile Include="TestCases\Pretty\VariableNaming.cs" />

75
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -69,159 +69,176 @@ namespace ICSharpCode.Decompiler.Tests @@ -69,159 +69,176 @@ namespace ICSharpCode.Decompiler.Tests
[Test]
public void HelloWorld()
{
Run();
Run(asmOptions: AssemblerOptions.UseDebug);
RunForLibrary();
RunForLibrary(asmOptions: AssemblerOptions.UseDebug);
}
[Test]
public void InlineAssignmentTest([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void CompoundAssignmentTest([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void ShortCircuit([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void ExceptionHandling([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Switch([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void DelegateConstruction([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void AnonymousTypes([Values(CompilerOptions.None, CompilerOptions.Optimize)] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Async([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Lock([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Using([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void LiftedOperators([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Generics([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Loops([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void PropertiesAndEvents([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void AutoProperties([ValueSource("roslynOnlyOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void QueryExpressions([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void TypeAnalysisTests([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void CheckedUnchecked([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void UnsafeCode([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void PInvoke([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
// This tests needs our own disassembler; ildasm has a bug with marshalinfo.
Run(cscOptions: cscOptions, asmOptions: AssemblerOptions.UseOwnDisassembler);
RunForLibrary(cscOptions: cscOptions, asmOptions: AssemblerOptions.UseOwnDisassembler);
}
[Test]
public void InitializerTests([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void ExpressionTrees([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void FixProxyCalls([Values(CompilerOptions.None, CompilerOptions.Optimize, CompilerOptions.UseRoslyn)] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void VariableNaming([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void VariableNamingWithoutSymbols([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { UseDebugSymbols = false });
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { UseDebugSymbols = false });
}
[Test]
public void CS72_PrivateProtected([ValueSource("roslynOnlyOptions")] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void AsyncMain([ValueSource("roslynOnlyOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
}
void RunForLibrary([CallerMemberName] string testName = null, AssemblerOptions asmOptions = AssemblerOptions.None, CompilerOptions cscOptions = CompilerOptions.None, DecompilerSettings decompilerSettings = null)
{
Run(testName, asmOptions | AssemblerOptions.Library, cscOptions | CompilerOptions.Library, decompilerSettings);
}
[Test]
@ -239,7 +256,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -239,7 +256,7 @@ namespace ICSharpCode.Decompiler.Tests
// re-create .il file if necessary
CompilerResults output = null;
try {
output = Tester.CompileCSharp(csFile, cscOptions | CompilerOptions.Library);
output = Tester.CompileCSharp(csFile, cscOptions);
Tester.Disassemble(output.PathToAssembly, ilFile, asmOptions);
} finally {
if (output != null)
@ -247,7 +264,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -247,7 +264,7 @@ namespace ICSharpCode.Decompiler.Tests
}
}
var executable = Tester.AssembleIL(ilFile, asmOptions | AssemblerOptions.Library);
var executable = Tester.AssembleIL(ilFile, asmOptions);
var decompiled = Tester.DecompileCSharp(executable, decompilerSettings);
CodeAssert.FilesAreEqual(csFile, decompiled, Tester.GetPreprocessorSymbols(cscOptions).ToArray());

14
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncMain.cs

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class AsyncMain
{
public static async Task Main(string[] args)
{
await Task.Delay(1000);
Console.WriteLine("Hello Wolrd!");
}
}
}

209
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncMain.opt.roslyn.il

@ -0,0 +1,209 @@ @@ -0,0 +1,209 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Tous droits r?serv?s.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly AsyncMain
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module AsyncMain.exe
// MVID: {B9141C5A-989C-49C7-986D-91A53478FC26}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x050A0000
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain
extends [mscorlib]System.Object
{
.class auto ansi sealed nested private beforefieldinit '<Main>d__0'
extends [mscorlib]System.ValueType
implements [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public int32 '<>1__state'
.field public valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder '<>t__builder'
.field private valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter '<>u__1'
.method private hidebysig newslot virtual final
instance void MoveNext() cil managed
{
.override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext
// Code size 157 (0x9d)
.maxstack 3
.locals init (int32 V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_1,
class [mscorlib]System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0006: stloc.0
.try
{
IL_0007: ldloc.0
IL_0008: brfalse.s IL_0043
IL_000a: ldc.i4 0x3e8
IL_000f: call class [mscorlib]System.Threading.Tasks.Task [mscorlib]System.Threading.Tasks.Task::Delay(int32)
IL_0014: callvirt instance valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter [mscorlib]System.Threading.Tasks.Task::GetAwaiter()
IL_0019: stloc.1
IL_001a: ldloca.s V_1
IL_001c: call instance bool [mscorlib]System.Runtime.CompilerServices.TaskAwaiter::get_IsCompleted()
IL_0021: brtrue.s IL_005f
IL_0023: ldarg.0
IL_0024: ldc.i4.0
IL_0025: dup
IL_0026: stloc.0
IL_0027: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_002c: ldarg.0
IL_002d: ldloc.1
IL_002e: stfld valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>u__1'
IL_0033: ldarg.0
IL_0034: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0039: ldloca.s V_1
IL_003b: ldarg.0
IL_003c: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::AwaitUnsafeOnCompleted<valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter,valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'>(!!0&,
!!1&)
IL_0041: leave.s IL_009c
IL_0043: ldarg.0
IL_0044: ldfld valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>u__1'
IL_0049: stloc.1
IL_004a: ldarg.0
IL_004b: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>u__1'
IL_0050: initobj [mscorlib]System.Runtime.CompilerServices.TaskAwaiter
IL_0056: ldarg.0
IL_0057: ldc.i4.m1
IL_0058: dup
IL_0059: stloc.0
IL_005a: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_005f: ldloca.s V_1
IL_0061: call instance void [mscorlib]System.Runtime.CompilerServices.TaskAwaiter::GetResult()
IL_0066: ldstr "Hello Wolrd!"
IL_006b: call void [mscorlib]System.Console::WriteLine(string)
IL_0070: leave.s IL_0089
} // end .try
catch [mscorlib]System.Exception
{
IL_0072: stloc.2
IL_0073: ldarg.0
IL_0074: ldc.i4.s -2
IL_0076: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_007b: ldarg.0
IL_007c: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0081: ldloc.2
IL_0082: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetException(class [mscorlib]System.Exception)
IL_0087: leave.s IL_009c
} // end handler
IL_0089: ldarg.0
IL_008a: ldc.i4.s -2
IL_008c: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0091: ldarg.0
IL_0092: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0097: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetResult()
IL_009c: ret
} // end of method '<Main>d__0'::MoveNext
.method private hidebysig newslot virtual final
instance void SetStateMachine(class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) cil managed
{
.custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
.override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::SetStateMachine
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0006: ldarg.1
IL_0007: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetStateMachine(class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine)
IL_000c: ret
} // end of method '<Main>d__0'::SetStateMachine
} // end of class '<Main>d__0'
.method public hidebysig static class [mscorlib]System.Threading.Tasks.Task
Main(string[] args) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 42 49 43 53 68 61 72 70 43 6F 64 65 2E 44 // ..BICSharpCode.D
65 63 6F 6D 70 69 6C 65 72 2E 54 65 73 74 73 2E // ecompiler.Tests.
54 65 73 74 43 61 73 65 73 2E 50 72 65 74 74 79 // TestCases.Pretty
2E 41 73 79 6E 63 4D 61 69 6E 2B 3C 4D 61 69 6E // .AsyncMain+<Main
3E 64 5F 5F 30 00 00 ) // >d__0..
// Code size 49 (0x31)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0' V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder V_1)
IL_0000: ldloca.s V_0
IL_0002: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::Create()
IL_0007: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_000c: ldloca.s V_0
IL_000e: ldc.i4.m1
IL_000f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0014: ldloc.0
IL_0015: ldfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_001a: stloc.1
IL_001b: ldloca.s V_1
IL_001d: ldloca.s V_0
IL_001f: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::Start<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'>(!!0&)
IL_0024: ldloca.s V_0
IL_0026: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_002b: call instance class [mscorlib]System.Threading.Tasks.Task [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::get_Task()
IL_0030: ret
} // end of method AsyncMain::Main
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method AsyncMain::.ctor
.method private hidebysig specialname static
void '<Main>'(string[] args) cil managed
{
.entrypoint
// Code size 20 (0x14)
.maxstack 1
.locals init (valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_0)
IL_0000: ldarg.0
IL_0001: call class [mscorlib]System.Threading.Tasks.Task ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain::Main(string[])
IL_0006: callvirt instance valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter [mscorlib]System.Threading.Tasks.Task::GetAwaiter()
IL_000b: stloc.0
IL_000c: ldloca.s V_0
IL_000e: call instance void [mscorlib]System.Runtime.CompilerServices.TaskAwaiter::GetResult()
IL_0013: ret
} // end of method AsyncMain::'<Main>'
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

237
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncMain.roslyn.il

@ -0,0 +1,237 @@ @@ -0,0 +1,237 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Tous droits r?serv?s.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly AsyncMain
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module AsyncMain.exe
// MVID: {9AD23895-984A-4198-A22B-F506741986BA}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x04F10000
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain
extends [mscorlib]System.Object
{
.class auto ansi sealed nested private beforefieldinit '<Main>d__0'
extends [mscorlib]System.Object
implements [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public int32 '<>1__state'
.field public valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder '<>t__builder'
.field public string[] args
.field private valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter '<>u__1'
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method '<Main>d__0'::.ctor
.method private hidebysig newslot virtual final
instance void MoveNext() cil managed
{
.override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext
// Code size 170 (0xaa)
.maxstack 3
.locals init (int32 V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_1,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0' V_2,
class [mscorlib]System.Exception V_3)
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0006: stloc.0
.try
{
IL_0007: ldloc.0
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_004c
IL_000e: nop
IL_000f: ldc.i4 0x3e8
IL_0014: call class [mscorlib]System.Threading.Tasks.Task [mscorlib]System.Threading.Tasks.Task::Delay(int32)
IL_0019: callvirt instance valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter [mscorlib]System.Threading.Tasks.Task::GetAwaiter()
IL_001e: stloc.1
IL_001f: ldloca.s V_1
IL_0021: call instance bool [mscorlib]System.Runtime.CompilerServices.TaskAwaiter::get_IsCompleted()
IL_0026: brtrue.s IL_0068
IL_0028: ldarg.0
IL_0029: ldc.i4.0
IL_002a: dup
IL_002b: stloc.0
IL_002c: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0031: ldarg.0
IL_0032: ldloc.1
IL_0033: stfld valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>u__1'
IL_0038: ldarg.0
IL_0039: stloc.2
IL_003a: ldarg.0
IL_003b: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0040: ldloca.s V_1
IL_0042: ldloca.s V_2
IL_0044: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::AwaitUnsafeOnCompleted<valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter,class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'>(!!0&,
!!1&)
IL_0049: nop
IL_004a: leave.s IL_00a9
IL_004c: ldarg.0
IL_004d: ldfld valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>u__1'
IL_0052: stloc.1
IL_0053: ldarg.0
IL_0054: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>u__1'
IL_0059: initobj [mscorlib]System.Runtime.CompilerServices.TaskAwaiter
IL_005f: ldarg.0
IL_0060: ldc.i4.m1
IL_0061: dup
IL_0062: stloc.0
IL_0063: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0068: ldloca.s V_1
IL_006a: call instance void [mscorlib]System.Runtime.CompilerServices.TaskAwaiter::GetResult()
IL_006f: nop
IL_0070: ldstr "Hello Wolrd!"
IL_0075: call void [mscorlib]System.Console::WriteLine(string)
IL_007a: nop
IL_007b: leave.s IL_0095
} // end .try
catch [mscorlib]System.Exception
{
IL_007d: stloc.3
IL_007e: ldarg.0
IL_007f: ldc.i4.s -2
IL_0081: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_0086: ldarg.0
IL_0087: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_008c: ldloc.3
IL_008d: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetException(class [mscorlib]System.Exception)
IL_0092: nop
IL_0093: leave.s IL_00a9
} // end handler
IL_0095: ldarg.0
IL_0096: ldc.i4.s -2
IL_0098: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_009d: ldarg.0
IL_009e: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_00a3: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetResult()
IL_00a8: nop
IL_00a9: ret
} // end of method '<Main>d__0'::MoveNext
.method private hidebysig newslot virtual final
instance void SetStateMachine(class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) cil managed
{
.custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
.override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::SetStateMachine
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method '<Main>d__0'::SetStateMachine
} // end of class '<Main>d__0'
.method public hidebysig static class [mscorlib]System.Threading.Tasks.Task
Main(string[] args) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 42 49 43 53 68 61 72 70 43 6F 64 65 2E 44 // ..BICSharpCode.D
65 63 6F 6D 70 69 6C 65 72 2E 54 65 73 74 73 2E // ecompiler.Tests.
54 65 73 74 43 61 73 65 73 2E 50 72 65 74 74 79 // TestCases.Pretty
2E 41 73 79 6E 63 4D 61 69 6E 2B 3C 4D 61 69 6E // .AsyncMain+<Main
3E 64 5F 5F 30 00 00 ) // >d__0..
.custom instance void [mscorlib]System.Diagnostics.DebuggerStepThroughAttribute::.ctor() = ( 01 00 00 00 )
// Code size 59 (0x3b)
.maxstack 2
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0' V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder V_1)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::.ctor()
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ldarg.0
IL_0008: stfld string[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::args
IL_000d: ldloc.0
IL_000e: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::Create()
IL_0013: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0018: ldloc.0
IL_0019: ldc.i4.m1
IL_001a: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>1__state'
IL_001f: ldloc.0
IL_0020: ldfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0025: stloc.1
IL_0026: ldloca.s V_1
IL_0028: ldloca.s V_0
IL_002a: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::Start<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'>(!!0&)
IL_002f: ldloc.0
IL_0030: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain/'<Main>d__0'::'<>t__builder'
IL_0035: call instance class [mscorlib]System.Threading.Tasks.Task [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::get_Task()
IL_003a: ret
} // end of method AsyncMain::Main
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method AsyncMain::.ctor
.method private hidebysig specialname static
void '<Main>'(string[] args) cil managed
{
.entrypoint
// Code size 20 (0x14)
.maxstack 1
.locals init (valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_0)
IL_0000: ldarg.0
IL_0001: call class [mscorlib]System.Threading.Tasks.Task ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain::Main(string[])
IL_0006: callvirt instance valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter [mscorlib]System.Threading.Tasks.Task::GetAwaiter()
IL_000b: stloc.0
IL_000c: ldloca.s V_0
IL_000e: call instance void [mscorlib]System.Runtime.CompilerServices.TaskAwaiter::GetResult()
IL_0013: ret
} // end of method AsyncMain::'<Main>'
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AsyncMain
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

31
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS72_PrivateProtected.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class CS72_PrivateProtected
{
private protected int Property {
get;
}
private protected void Method()
{
}
}
}

83
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS72_PrivateProtected.opt.roslyn.il

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly CS72_PrivateProtected
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module CS72_PrivateProtected.dll
// MVID: {16957694-0DCC-41BA-B992-22F83B96A9D7}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x031E0000
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected
extends [mscorlib]System.Object
{
.field private initonly int32 '<Property>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.method famandassem hidebysig specialname
instance int32 get_Property() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected::'<Property>k__BackingField'
IL_0006: ret
} // end of method CS72_PrivateProtected::get_Property
.method famandassem hidebysig instance void
Method() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method CS72_PrivateProtected::Method
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method CS72_PrivateProtected::.ctor
.property instance int32 Property()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected::get_Property()
} // end of property CS72_PrivateProtected::Property
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

86
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS72_PrivateProtected.roslyn.il

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly CS72_PrivateProtected
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module CS72_PrivateProtected.dll
// MVID: {056F9D5F-A186-4957-9181-B6C798C15C6C}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x03A40000
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected
extends [mscorlib]System.Object
{
.field private initonly int32 '<Property>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
.method famandassem hidebysig specialname
instance int32 get_Property() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected::'<Property>k__BackingField'
IL_0006: ret
} // end of method CS72_PrivateProtected::get_Property
.method famandassem hidebysig instance void
Method() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method CS72_PrivateProtected::Method
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method CS72_PrivateProtected::.ctor
.property instance int32 Property()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected::get_Property()
} // end of property CS72_PrivateProtected::Property
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CS72_PrivateProtected
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

15
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs

@ -376,6 +376,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -376,6 +376,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
});
}
public void NestedListWithIndexInitializer()
{
#if !OPT
List<List<int>> list = new List<List<int>> {
#else
List<List<int>> obj = new List<List<int>> {
#endif
[0] = {
1,
2,
3
}
};
}
#endif
public static void ObjectInitializerWithInitializationOfDeeplyNestedObjects()

12
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.il

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '31sn40gd'
.assembly rzivg0mq
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
@ -25,15 +25,15 @@ @@ -25,15 +25,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '31sn40gd.dll'
// MVID: {EE7CB403-8040-4C94-B17A-F697CE60CA23}
.module rzivg0mq.dll
// MVID: {66592AAC-07E3-4F52-A96F-0428775E7A0F}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02FB0000
// Image base: 0x00E00000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1513,8 +1513,8 @@ @@ -1513,8 +1513,8 @@
IL_0006: ret
} // end of method InitializerTests::.ctor
.method private hidebysig static void '<NotAnObjectInitializerWithEvent>b__7'(object sender,
class [mscorlib]System.EventArgs e) cil managed
.method private hidebysig static void '<NotAnObjectInitializerWithEvent>b__7'(object param0,
class [mscorlib]System.EventArgs param1) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 8 (0x8)

12
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.il

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly awwuldf0
.assembly n52bfodk
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
@ -25,15 +25,15 @@ @@ -25,15 +25,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module awwuldf0.dll
// MVID: {59891EFA-EBA3-4F9A-9034-4F24037CEC15}
.module n52bfodk.dll
// MVID: {2B30E2AC-D797-4A69-ACEC-93251C343504}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x03070000
// Image base: 0x037A0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1275,8 +1275,8 @@ @@ -1275,8 +1275,8 @@
IL_0006: ret
} // end of method InitializerTests::.ctor
.method private hidebysig static void '<NotAnObjectInitializerWithEvent>b__7'(object sender,
class [mscorlib]System.EventArgs e) cil managed
.method private hidebysig static void '<NotAnObjectInitializerWithEvent>b__7'(object param0,
class [mscorlib]System.EventArgs param1) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 6 (0x6)

45
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il

@ -30,14 +30,14 @@ @@ -30,14 +30,14 @@
.ver 0:0:0:0
}
.module InitializerTests.dll
// MVID: {8AE31202-72A4-4C73-86BF-EE49F9DE8C56}
// MVID: {AA17E92F-AE3B-4AA5-91C9-716D2E842EE5}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02EC0000
// Image base: 0x01160000
// =============== CLASS MEMBERS DECLARATION ===================
@ -504,7 +504,7 @@ @@ -504,7 +504,7 @@
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__23_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__42_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__43_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -526,8 +526,8 @@ @@ -526,8 +526,8 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__23_0'(object sender,
class [mscorlib]System.EventArgs e) cil managed
'<NotAnObjectInitializerWithEvent>b__23_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 6 (0x6)
.maxstack 8
@ -536,7 +536,7 @@ @@ -536,7 +536,7 @@
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__23_0'
.method assembly hidebysig instance bool
'<Bug270_NestedInitialisers>b__42_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{
// Code size 17 (0x11)
.maxstack 8
@ -546,7 +546,7 @@ @@ -546,7 +546,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0010: ret
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__42_0'
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__43_0'
} // end of class '<>c'
@ -1064,6 +1064,31 @@ @@ -1064,6 +1064,31 @@
IL_0081: ret
} // end of method InitializerTests::MixedObjectAndDictInitializer
.method public hidebysig instance void
NestedListWithIndexInitializer() cil managed
{
// Code size 46 (0x2e)
.maxstack 8
IL_0000: newobj instance void class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::.ctor()
IL_0005: dup
IL_0006: ldc.i4.0
IL_0007: callvirt instance !0 class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::get_Item(int32)
IL_000c: ldc.i4.1
IL_000d: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::Add(!0)
IL_0012: dup
IL_0013: ldc.i4.0
IL_0014: callvirt instance !0 class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::get_Item(int32)
IL_0019: ldc.i4.2
IL_001a: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::Add(!0)
IL_001f: dup
IL_0020: ldc.i4.0
IL_0021: callvirt instance !0 class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::get_Item(int32)
IL_0026: ldc.i4.3
IL_0027: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::Add(!0)
IL_002c: pop
IL_002d: ret
} // end of method InitializerTests::NestedListWithIndexInitializer
.method public hidebysig static void ObjectInitializerWithInitializationOfDeeplyNestedObjects() cil managed
{
// Code size 77 (0x4d)
@ -1282,17 +1307,17 @@ @@ -1282,17 +1307,17 @@
IL_0033: callvirt instance void [mscorlib]System.Globalization.CultureInfo::set_DateTimeFormat(class [mscorlib]System.Globalization.DateTimeFormatInfo)
IL_0038: dup
IL_0039: ldloc.0
IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__42_0'
IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__43_0'
IL_003f: dup
IL_0040: brtrue.s IL_0059
IL_0042: pop
IL_0043: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9'
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__42_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_004e: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object,
native int)
IL_0053: dup
IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__42_0'
IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__43_0'
IL_0059: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
class [mscorlib]System.Func`2<!!0,bool>)
IL_005e: call !!0 [System.Core]System.Linq.Enumerable::First<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)

50
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il

@ -30,14 +30,14 @@ @@ -30,14 +30,14 @@
.ver 0:0:0:0
}
.module InitializerTests.dll
// MVID: {4E6BCF8B-3662-4EB0-88AA-8085A69A4D25}
// MVID: {3A200EF2-470A-47EB-B524-B0751246AB5E}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02C10000
// Image base: 0x010E0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -531,7 +531,7 @@ @@ -531,7 +531,7 @@
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__23_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__42_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__43_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -554,8 +554,8 @@ @@ -554,8 +554,8 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__23_0'(object sender,
class [mscorlib]System.EventArgs e) cil managed
'<NotAnObjectInitializerWithEvent>b__23_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 8 (0x8)
.maxstack 8
@ -566,7 +566,7 @@ @@ -566,7 +566,7 @@
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__23_0'
.method assembly hidebysig instance bool
'<Bug270_NestedInitialisers>b__42_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{
// Code size 17 (0x11)
.maxstack 8
@ -576,7 +576,7 @@ @@ -576,7 +576,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0010: ret
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__42_0'
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__43_0'
} // end of class '<>c'
@ -1245,6 +1245,36 @@ @@ -1245,6 +1245,36 @@
IL_0088: ret
} // end of method InitializerTests::MixedObjectAndDictInitializer
.method public hidebysig instance void
NestedListWithIndexInitializer() cil managed
{
// Code size 50 (0x32)
.maxstack 3
.locals init (class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>> V_0)
IL_0000: nop
IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::.ctor()
IL_0006: dup
IL_0007: ldc.i4.0
IL_0008: callvirt instance !0 class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::get_Item(int32)
IL_000d: ldc.i4.1
IL_000e: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::Add(!0)
IL_0013: nop
IL_0014: dup
IL_0015: ldc.i4.0
IL_0016: callvirt instance !0 class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::get_Item(int32)
IL_001b: ldc.i4.2
IL_001c: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::Add(!0)
IL_0021: nop
IL_0022: dup
IL_0023: ldc.i4.0
IL_0024: callvirt instance !0 class [mscorlib]System.Collections.Generic.List`1<class [mscorlib]System.Collections.Generic.List`1<int32>>::get_Item(int32)
IL_0029: ldc.i4.3
IL_002a: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::Add(!0)
IL_002f: nop
IL_0030: stloc.0
IL_0031: ret
} // end of method InitializerTests::NestedListWithIndexInitializer
.method public hidebysig static void ObjectInitializerWithInitializationOfDeeplyNestedObjects() cil managed
{
// Code size 82 (0x52)
@ -1499,17 +1529,17 @@ @@ -1499,17 +1529,17 @@
IL_003b: nop
IL_003c: dup
IL_003d: ldloc.0
IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__42_0'
IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__43_0'
IL_0043: dup
IL_0044: brtrue.s IL_005d
IL_0046: pop
IL_0047: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9'
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__42_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_0052: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object,
native int)
IL_0057: dup
IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__42_0'
IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__43_0'
IL_005d: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
class [mscorlib]System.Func`2<!!0,bool>)
IL_0062: call !!0 [System.Core]System.Linq.Enumerable::First<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)

6
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -204,6 +204,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -204,6 +204,8 @@ namespace ICSharpCode.Decompiler.CSharp
return true;
if (settings.AnonymousMethods && method.HasGeneratedName() && method.IsCompilerGenerated())
return true;
if (settings.AsyncAwait && AsyncAwaitDecompiler.IsCompilerGeneratedMainMethod(method))
return true;
}
TypeDefinition type = member as TypeDefinition;
@ -826,15 +828,15 @@ namespace ICSharpCode.Decompiler.CSharp @@ -826,15 +828,15 @@ namespace ICSharpCode.Decompiler.CSharp
{
Debug.Assert(decompilationContext.CurrentMember == field);
var typeSystemAstBuilder = CreateAstBuilder(decompilationContext);
if (decompilationContext.CurrentTypeDefinition.Kind == TypeKind.Enum) {
if (decompilationContext.CurrentTypeDefinition.Kind == TypeKind.Enum && field.ConstantValue != null) {
var index = decompilationContext.CurrentTypeDefinition.Members.IndexOf(field);
long previousValue = -1;
if (index > 0) {
var previousMember = (IField)decompilationContext.CurrentTypeDefinition.Members[index - 1];
previousValue = (long)CSharpPrimitiveCast.Cast(TypeCode.Int64, previousMember.ConstantValue, false);
}
long initValue = (long)CSharpPrimitiveCast.Cast(TypeCode.Int64, field.ConstantValue, false);
var enumDec = new EnumMemberDeclaration { Name = field.Name };
long initValue = (long)CSharpPrimitiveCast.Cast(TypeCode.Int64, field.ConstantValue, false);
if (decompilationContext.CurrentTypeDefinition.Attributes.Any(a => a.AttributeType.FullName == "System.FlagsAttribute")) {
enumDec.Initializer = typeSystemAstBuilder.ConvertConstantValue(decompilationContext.CurrentTypeDefinition.EnumUnderlyingType, field.ConstantValue);
if (enumDec.Initializer is PrimitiveExpression primitive && initValue > 9)

6
ICSharpCode.Decompiler/CSharp/CallBuilder.cs

@ -117,7 +117,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -117,7 +117,7 @@ namespace ICSharpCode.Decompiler.CSharp
expandedArguments.Add(expressionBuilder.GetDefaultValueExpression(elementType).WithoutILInstruction());
}
}
if (IsUnambiguousCall(expectedTargetDetails, method, target, Array.Empty<IType>(), expandedArguments) == OverloadResolutionErrors.None) {
if (IsUnambiguousCall(expectedTargetDetails, method, target, Empty<IType>.Array, expandedArguments) == OverloadResolutionErrors.None) {
isExpandedForm = true;
expectedParameters = expandedParameters;
arguments = expandedArguments.SelectList(a => new TranslatedExpression(a.Expression.Detach()));
@ -170,7 +170,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -170,7 +170,7 @@ namespace ICSharpCode.Decompiler.CSharp
.WithRR(rr);
} else {
if (IsUnambiguousCall(expectedTargetDetails, method, target, Array.Empty<IType>(), arguments) != OverloadResolutionErrors.None) {
if (IsUnambiguousCall(expectedTargetDetails, method, target, Empty<IType>.Array, arguments) != OverloadResolutionErrors.None) {
for (int i = 0; i < arguments.Count; i++) {
if (settings.AnonymousTypes && expectedParameters[i].Type.ContainsAnonymousType()) {
if (arguments[i].Expression is LambdaExpression lambda) {
@ -199,7 +199,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -199,7 +199,7 @@ namespace ICSharpCode.Decompiler.CSharp
bool requireTypeArguments = false;
bool targetCasted = false;
bool argumentsCasted = false;
IType[] typeArguments = Array.Empty<IType>();
IType[] typeArguments = Empty<IType>.Array;
OverloadResolutionErrors errors;
while ((errors = IsUnambiguousCall(expectedTargetDetails, method, target, typeArguments, arguments)) != OverloadResolutionErrors.None) {

19
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -436,12 +436,23 @@ namespace ICSharpCode.Decompiler.CSharp @@ -436,12 +436,23 @@ namespace ICSharpCode.Decompiler.CSharp
protected internal override TranslatedExpression VisitStLoc(StLoc inst, TranslationContext context)
{
var translatedValue = Translate(inst.Value, typeHint: inst.Variable.Type);
if (inst.Variable.Kind == VariableKind.StackSlot && inst.Variable.IsSingleDefinition
&& inst.Variable.StackType == translatedValue.Type.GetStackType()
&& translatedValue.Type.Kind != TypeKind.Null && !loadedVariablesSet.Contains(inst.Variable)) {
inst.Variable.Type = translatedValue.Type;
if (inst.Variable.Kind == VariableKind.StackSlot && !loadedVariablesSet.Contains(inst.Variable)) {
// Stack slots in the ILAst have inaccurate types (e.g. System.Object for StackType.O)
// so we should replace them with more accurate types where possible:
if ((inst.Variable.IsSingleDefinition || IsOtherValueType(translatedValue.Type))
&& inst.Variable.StackType == translatedValue.Type.GetStackType()
&& translatedValue.Type.Kind != TypeKind.Null) {
inst.Variable.Type = translatedValue.Type;
} else if (inst.Value.MatchDefaultValue(out var type) && IsOtherValueType(type)) {
inst.Variable.Type = type;
}
}
return Assignment(ConvertVariable(inst.Variable).WithoutILInstruction(), translatedValue).WithILInstruction(inst);
bool IsOtherValueType(IType type)
{
return type.IsReferenceType == false && type.GetStackType() == StackType.O;
}
}
protected internal override TranslatedExpression VisitComp(Comp inst, TranslationContext context)

2
ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs

@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
// Not worth using a dictionary for such few elements.
// This table is sorted in the order that modifiers should be output when generating code.
static readonly Modifiers[] allModifiers = {
Modifiers.Public, Modifiers.Protected, Modifiers.Private, Modifiers.Internal,
Modifiers.Public, Modifiers.Private, Modifiers.Protected, Modifiers.Internal,
Modifiers.New,
Modifiers.Unsafe,
Modifiers.Abstract, Modifiers.Virtual, Modifiers.Sealed, Modifiers.Static, Modifiers.Override,

3
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -1057,8 +1057,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -1057,8 +1057,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
case Accessibility.Internal:
return Modifiers.Internal;
case Accessibility.ProtectedOrInternal:
case Accessibility.ProtectedAndInternal:
return Modifiers.Protected | Modifiers.Internal;
case Accessibility.ProtectedAndInternal:
return Modifiers.Private | Modifiers.Protected;
default:
return Modifiers.None;
}

3
ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs

@ -132,7 +132,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -132,7 +132,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
if (!(fieldOrPropertyOrEvent is IField) && !(fieldOrPropertyOrEvent is IProperty) && !(fieldOrPropertyOrEvent is IEvent))
break;
AstNode fieldOrPropertyOrEventDecl = members.FirstOrDefault(f => f.GetSymbol() == fieldOrPropertyOrEvent);
if (fieldOrPropertyOrEventDecl == null)
// Cannot transform if member is not found or if it is a custom event.
if (fieldOrPropertyOrEventDecl == null || fieldOrPropertyOrEventDecl is CustomEventDeclaration)
break;
Expression initializer = m.Get<Expression>("initializer").Single();
// 'this'/'base' cannot be used in initializers

12
ICSharpCode.Decompiler/DecompilerSettings.cs

@ -360,6 +360,18 @@ namespace ICSharpCode.Decompiler @@ -360,6 +360,18 @@ namespace ICSharpCode.Decompiler
}
}
bool expandMemberDefinitions = false;
public bool ExpandMemberDefinitions {
get { return expandMemberDefinitions; }
set {
if (expandMemberDefinitions != value) {
expandMemberDefinitions = value;
OnPropertyChanged();
}
}
}
#region Options to aid VB decompilation
bool introduceIncrementAndDecrement = true;

6
ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs

@ -45,6 +45,8 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -45,6 +45,8 @@ namespace ICSharpCode.Decompiler.Disassembler
set => methodBodyDisassembler.ShowSequencePoints = value;
}
public bool ExpandMemberDefinitions { get; set; } = false;
public ReflectionDisassembler(ITextOutput output, CancellationToken cancellationToken)
: this(output, new MethodBodyDisassembler(output, cancellationToken), cancellationToken)
{
@ -846,7 +848,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -846,7 +848,7 @@ namespace ICSharpCode.Decompiler.Disassembler
output.Write(DisassemblerHelpers.Escape(type.DeclaringType != null ? type.Name : type.FullName));
WriteTypeParameters(output, type);
output.MarkFoldStart(defaultCollapsed: isInType);
output.MarkFoldStart(defaultCollapsed: !ExpandMemberDefinitions && isInType);
output.WriteLine();
if (type.BaseType != null) {
@ -1003,7 +1005,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -1003,7 +1005,7 @@ namespace ICSharpCode.Decompiler.Disassembler
void OpenBlock(bool defaultCollapsed)
{
output.MarkFoldStart(defaultCollapsed: defaultCollapsed);
output.MarkFoldStart(defaultCollapsed: !ExpandMemberDefinitions && defaultCollapsed);
output.WriteLine();
output.WriteLine("{");
output.Indent();

4
ICSharpCode.Decompiler/DotNetCore/DotNetCorePathFinder.cs

@ -86,14 +86,14 @@ namespace ICSharpCode.Decompiler @@ -86,14 +86,14 @@ namespace ICSharpCode.Decompiler
static IEnumerable<DotNetCorePackageInfo> LoadPackageInfos(string depsJsonFileName, string targetFramework)
{
var dependencies = JsonReader.Parse(File.ReadAllText(depsJsonFileName));
var runtimeInfos = dependencies["targets"][targetFramework].AsJsonObject;
var runtimeInfos = dependencies["targets"][targetFramework + "/"].AsJsonObject;
var libraries = dependencies["libraries"].AsJsonObject;
if (runtimeInfos == null || libraries == null)
yield break;
foreach (var library in libraries) {
var type = library.Value["type"].AsString;
var path = library.Value["path"].AsString;
var runtimeInfo = runtimeInfos[library.Key]["runtime"].AsJsonObject;
var runtimeInfo = runtimeInfos[library.Key].AsJsonObject?["runtime"].AsJsonObject;
string[] components = new string[runtimeInfo?.Count ?? 0];
if (runtimeInfo != null) {
int i = 0;

15
ICSharpCode.Decompiler/DotNetCore/DotNetCorePathFinderExtensions.cs

@ -43,6 +43,21 @@ namespace ICSharpCode.Decompiler @@ -43,6 +43,21 @@ namespace ICSharpCode.Decompiler
}
}
public void AddMessageOnce(string fullName, MessageKind kind, string message)
{
lock (loadedAssemblyReferences) {
if (!loadedAssemblyReferences.TryGetValue(fullName, out var referenceInfo)) {
referenceInfo = new UnresolvedAssemblyNameReference(fullName);
loadedAssemblyReferences.Add(fullName, referenceInfo);
referenceInfo.Messages.Add((kind, message));
} else {
var lastMsg = referenceInfo.Messages.LastOrDefault();
if (kind != lastMsg.Item1 && message != lastMsg.Item2)
referenceInfo.Messages.Add((kind, message));
}
}
}
public bool TryGetInfo(string fullName, out UnresolvedAssemblyNameReference info)
{
lock (loadedAssemblyReferences) {

4
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -4,12 +4,12 @@ @@ -4,12 +4,12 @@
<PropertyGroup>
<TargetFramework Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0</TargetFramework>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard2.0;net46;net45</TargetFrameworks>
<Description>IL decompiler engine</Description>
<Company>ic#code</Company>
<Product>ILSpy</Product>
<Copyright>Copyright 2011-2017 AlphaSierraPapa for the SharpDevelop Team</Copyright>
<Copyright>Copyright 2011-2018 AlphaSierraPapa for the SharpDevelop Team</Copyright>
<NeutralLanguage>en-US</NeutralLanguage>
<GenerateAssemblyVersionAttribute>False</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>False</GenerateAssemblyFileVersionAttribute>

3
ICSharpCode.Decompiler/ICSharpCode.Decompiler.nuspec.template

@ -25,6 +25,9 @@ @@ -25,6 +25,9 @@
<file src="bin\$Configuration$\net46\ICSharpCode.Decompiler.dll" target="lib\net46" />
<file src="bin\$Configuration$\net46\ICSharpCode.Decompiler.pdb" target="lib\net46" />
<file src="bin\$Configuration$\net45\ICSharpCode.Decompiler.dll" target="lib\net45" />
<file src="bin\$Configuration$\net45\ICSharpCode.Decompiler.pdb" target="lib\net45" />
<file src="bin\$Configuration$\netstandard2.0\ICSharpCode.Decompiler.dll" target="lib\netstandard2.0" />
<file src="bin\$Configuration$\netstandard2.0\ICSharpCode.Decompiler.pdb" target="lib\netstandard2.0" />
</files>

6
ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs

@ -20,6 +20,7 @@ using ICSharpCode.Decompiler.CSharp; @@ -20,6 +20,7 @@ using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.IL.Transforms;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.Util;
using Mono.Cecil;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -44,6 +45,11 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -44,6 +45,11 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
return false;
}
public static bool IsCompilerGeneratedMainMethod(MethodDefinition method)
{
return method == method.Module.Assembly?.EntryPoint && method.Name.Equals("<Main>", StringComparison.Ordinal);
}
enum AsyncMethodType
{
Void,

2
ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

@ -254,7 +254,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -254,7 +254,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
instruction = call.Arguments[0];
if (method.IsAccessor) {
var property = method.AccessorOwner as IProperty;
var isGetter = property?.Getter == method;
var isGetter = method.Equals(property?.Getter);
var indices = call.Arguments.Skip(1).Take(call.Arguments.Count - (isGetter ? 1 : 2)).ToArray();
if (possibleIndexVariables != null) {
// Mark all index variables as used

3
ICSharpCode.Decompiler/Output/TextTokenWriter.cs

@ -40,6 +40,7 @@ namespace ICSharpCode.Decompiler @@ -40,6 +40,7 @@ namespace ICSharpCode.Decompiler
bool lastUsingDeclaration;
public bool FoldBraces = false;
public bool ExpandMemberDefinitions = false;
public TextTokenWriter(ITextOutput output, DecompilerSettings settings, IDecompilerTypeSystem typeSystem)
{
@ -216,7 +217,7 @@ namespace ICSharpCode.Decompiler @@ -216,7 +217,7 @@ namespace ICSharpCode.Decompiler
if (braceLevelWithinType >= 0 || nodeStack.Peek() is TypeDeclaration)
braceLevelWithinType++;
if (nodeStack.OfType<BlockStatement>().Count() <= 1 || FoldBraces) {
output.MarkFoldStart(defaultCollapsed: braceLevelWithinType == 1);
output.MarkFoldStart(defaultCollapsed: !ExpandMemberDefinitions && braceLevelWithinType == 1);
}
output.Write("{");
break;

2
ICSharpCode.Decompiler/TypeSystem/Accessibility.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// <summary>
/// The entity is accessible in derived classes within the same project content.
/// </summary>
/// <remarks>C# does not support this accessibility.</remarks>
/// <remarks>This corresponds to C# 'private protected'.</remarks>
ProtectedAndInternal,
}

2
ICSharpCode.Decompiler/TypeSystem/TypeSystemExtensions.cs

@ -430,7 +430,7 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -430,7 +430,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// Gets all top level type definitions in the compilation.
/// This may include types from referenced assemblies that are not accessible in the main assembly.
/// </summary>
public static IEnumerable<ITypeDefinition> GetTopLevelTypeDefinitons (this ICompilation compilation)
public static IEnumerable<ITypeDefinition> GetTopLevelTypeDefinitions (this ICompilation compilation)
{
return compilation.Assemblies.SelectMany(a => a.TopLevelTypeDefinitions);
}

4
ILSpy.AddIn/ILSpy.AddIn.csproj

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
<Company>IC#Code</Company>
<Description>ILSpy</Description>
<NeutralLanguage>en-US</NeutralLanguage>
<Version>1.5.0.0</Version>
<FileVersion>1.5.0.0</FileVersion>
<Version>1.7.1.0</Version>
<FileVersion>1.7.1.0</FileVersion>
<EnableDefaultItems>False</EnableDefaultItems>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

3
ILSpy.AddIn/source.extension.vsixmanifest

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="ILSpy.AddIn.a9120dbe-164a-4891-842f-fb7829273838" Version="1.5" Language="en-US" Publisher="ic#code" />
<Identity Id="a9120dbe-164a-4891-842f-fb7829273838" Version="1.7.2.0" Language="en-US" Publisher="ic#code" />
<DisplayName>ILSpy</DisplayName>
<Description xml:space="preserve">Integrates the ILSpy decompiler into Visual Studio.</Description>
<MoreInfo>http://www.ilspy.net</MoreInfo>
@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Ultimate" Version="[14.0,15.0]" />
<InstallationTarget Id="Microsoft.VisualStudio.Premium" Version="[14.0,15.0]" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[14.0,15.0]" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,15.0]" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,15.0]" />
</Installation>

1
ILSpy/ILSpy.csproj

@ -349,6 +349,7 @@ @@ -349,6 +349,7 @@
<Resource Include="Images\FieldReadOnly.png" />
<Resource Include="Images\OverlayInternal.png" />
<Resource Include="Images\OverlayPrivate.png" />
<Resource Include="Images\OverlayPrivateProtected.png" />
<Resource Include="Images\OverlayProtected.png" />
<Resource Include="Images\OverlayProtectedInternal.png" />
<Resource Include="Images\OverlayCompilerControlled.png" />

1
ILSpy/Images/AccessOverlayIcon.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.ILSpy @@ -26,6 +26,7 @@ namespace ICSharpCode.ILSpy
Internal,
ProtectedInternal,
Private,
PrivateProtected,
CompilerControlled
}
}

2
ILSpy/Images/ILSpyNewIconList.txt

@ -39,7 +39,7 @@ OverlayProtected.png new (Fugue derived) @@ -39,7 +39,7 @@ OverlayProtected.png new (Fugue derived)
OverlayProtectedInternal.png new (Fugue derived)
OverlayStatic.png new (Fugue derived)
PInvokeMethod.png new (Fugue-Icon-Mashup)
PrivateInternal.png new (Fugue derived)
OverlayPrivateProtected.png new (Fugue derived)
Property.png ClassBrowserIcons\Icons.16x16.Property.png
ReferenceFolder.Closed.png ProjectBrowserIcons\ReferenceFolder.Closed.png
ReferenceFolder.Open.png ProjectBrowserIcons\ReferenceFolder.Open.png

4
ILSpy/Images/Images.cs

@ -95,6 +95,7 @@ namespace ICSharpCode.ILSpy @@ -95,6 +95,7 @@ namespace ICSharpCode.ILSpy
private static readonly BitmapImage OverlayInternal = LoadBitmap("OverlayInternal");
private static readonly BitmapImage OverlayProtectedInternal = LoadBitmap("OverlayProtectedInternal");
private static readonly BitmapImage OverlayPrivate = LoadBitmap("OverlayPrivate");
private static readonly BitmapImage OverlayPrivateProtected = LoadBitmap("OverlayPrivateProtected");
private static readonly BitmapImage OverlayCompilerControlled = LoadBitmap("OverlayCompilerControlled");
private static readonly BitmapImage OverlayStatic = LoadBitmap("OverlayStatic");
@ -295,6 +296,9 @@ namespace ICSharpCode.ILSpy @@ -295,6 +296,9 @@ namespace ICSharpCode.ILSpy
case AccessOverlayIcon.Private:
overlayImage = Images.OverlayPrivate;
break;
case AccessOverlayIcon.PrivateProtected:
overlayImage = Images.OverlayPrivateProtected;
break;
case AccessOverlayIcon.CompilerControlled:
overlayImage = Images.OverlayCompilerControlled;
break;

BIN
ILSpy/Images/OverlayPrivateProtected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

2
ILSpy/Languages/CSharpLanguage.cs

@ -98,7 +98,7 @@ namespace ICSharpCode.ILSpy @@ -98,7 +98,7 @@ namespace ICSharpCode.ILSpy
void WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
{
syntaxTree.AcceptVisitor(new InsertParenthesesVisitor { InsertParenthesesForReadability = true });
TokenWriter tokenWriter = new TextTokenWriter(output, settings, typeSystem) { FoldBraces = settings.FoldBraces };
TokenWriter tokenWriter = new TextTokenWriter(output, settings, typeSystem) { FoldBraces = settings.FoldBraces, ExpandMemberDefinitions = settings.ExpandMemberDefinitions };
if (output is ISmartTextOutput highlightingOutput) {
tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, highlightingOutput);
}

3
ILSpy/Languages/ILLanguage.cs

@ -48,7 +48,8 @@ namespace ICSharpCode.ILSpy @@ -48,7 +48,8 @@ namespace ICSharpCode.ILSpy
{
return new ReflectionDisassembler(output, options.CancellationToken) {
DetectControlStructure = detectControlStructure,
ShowSequencePoints = options.DecompilerSettings.ShowDebugInfo
ShowSequencePoints = options.DecompilerSettings.ShowDebugInfo,
ExpandMemberDefinitions = options.DecompilerSettings.ExpandMemberDefinitions
};
}

11
ILSpy/LoadedAssembly.cs

@ -267,13 +267,11 @@ namespace ICSharpCode.ILSpy @@ -267,13 +267,11 @@ namespace ICSharpCode.ILSpy
foreach (LoadedAssembly loaded in assemblyList.GetAssemblies()) {
var asmDef = loaded.GetAssemblyDefinitionOrNull();
if (asmDef != null && data.fullName.Equals(data.isWinRT ? asmDef.Name.Name : asmDef.FullName, StringComparison.OrdinalIgnoreCase)) {
LoadedAssemblyReferencesInfo.AddMessageOnce(data.fullName, MessageKind.Info, "Success - Found in Assembly List");
return loaded;
}
}
if (assemblyLoadDisableCount > 0)
return null;
if (data.isWinRT) {
file = Path.Combine(Environment.SystemDirectory, "WinMetadata", data.fullName + ".winmd");
} else {
@ -288,14 +286,17 @@ namespace ICSharpCode.ILSpy @@ -288,14 +286,17 @@ namespace ICSharpCode.ILSpy
}
}
if (loadingAssemblies.TryGetValue(file, out asm))
if (file != null && loadingAssemblies.TryGetValue(file, out asm))
return asm;
if (assemblyLoadDisableCount > 0)
return null;
if (file != null) {
LoadedAssemblyReferencesInfo.AddMessage(data.fullName, MessageKind.Info, "Success - Loading from: " + file);
asm = new LoadedAssembly(assemblyList, file) { IsAutoLoaded = true };
} else {
LoadedAssemblyReferencesInfo.AddMessage(data.fullName, MessageKind.Error, "Could not find reference: " + data.fullName);
LoadedAssemblyReferencesInfo.AddMessageOnce(data.fullName, MessageKind.Error, "Could not find reference: " + data.fullName);
return null;
}
loadingAssemblies.Add(file, asm);

4
ILSpy/MainWindow.xaml.cs

@ -273,7 +273,7 @@ namespace ICSharpCode.ILSpy @@ -273,7 +273,7 @@ namespace ICSharpCode.ILSpy
}
} else {
foreach (LoadedAssembly asm in commandLineLoadedAssemblies) {
ModuleDefinition def = asm.GetModuleDefinitionAsync().Result;
ModuleDefinition def = asm.GetModuleDefinitionOrNull();
if (def != null) {
MemberReference mr = XmlDocKeyProvider.FindMemberByKey(def, args.NavigateTo);
if (mr != null) {
@ -292,7 +292,7 @@ namespace ICSharpCode.ILSpy @@ -292,7 +292,7 @@ namespace ICSharpCode.ILSpy
} else if (commandLineLoadedAssemblies.Count == 1) {
// NavigateTo == null and an assembly was given on the command-line:
// Select the newly loaded assembly
JumpToReference(commandLineLoadedAssemblies[0].GetModuleDefinitionAsync().Result);
JumpToReference(commandLineLoadedAssemblies[0].GetModuleDefinitionOrNull());
}
if (args.Search != null)
{

1
ILSpy/Options/DecompilerSettingsPanel.xaml

@ -18,5 +18,6 @@ @@ -18,5 +18,6 @@
<CheckBox IsChecked="{Binding UsingDeclarations}">Insert using declarations</CheckBox>
<CheckBox IsChecked="{Binding FullyQualifyAmbiguousTypeNames}">Fully qualify ambiguous type names</CheckBox>
<CheckBox IsChecked="{Binding AlwaysUseBraces}">Always use braces</CheckBox>
<CheckBox IsChecked="{Binding ExpandMemberDefinitions}">Expand member definitions after decompilation</CheckBox>
</StackPanel>
</UserControl>

5
ILSpy/Options/DecompilerSettingsPanel.xaml.cs

@ -61,6 +61,8 @@ namespace ICSharpCode.ILSpy.Options @@ -61,6 +61,8 @@ namespace ICSharpCode.ILSpy.Options
s.ShowDebugInfo = (bool?)e.Attribute("showDebugInfo") ?? s.ShowDebugInfo;
s.ShowXmlDocumentation = (bool?)e.Attribute("xmlDoc") ?? s.ShowXmlDocumentation;
s.FoldBraces = (bool?)e.Attribute("foldBraces") ?? s.FoldBraces;
s.ExpandMemberDefinitions = (bool?)e.Attribute("expandMemberDefinitions") ?? s.ExpandMemberDefinitions;
s.RemoveDeadCode = (bool?)e.Attribute("removeDeadCode") ?? s.RemoveDeadCode;
s.UsingDeclarations = (bool?)e.Attribute("usingDeclarations") ?? s.UsingDeclarations;
s.FullyQualifyAmbiguousTypeNames = (bool?)e.Attribute("fullyQualifyAmbiguousTypeNames") ?? s.FullyQualifyAmbiguousTypeNames;
s.AlwaysUseBraces = (bool?)e.Attribute("alwaysUseBraces") ?? s.AlwaysUseBraces;
@ -82,7 +84,8 @@ namespace ICSharpCode.ILSpy.Options @@ -82,7 +84,8 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("showDebugInfo", s.ShowDebugInfo);
section.SetAttributeValue("xmlDoc", s.ShowXmlDocumentation);
section.SetAttributeValue("foldBraces", s.FoldBraces);
section.SetAttributeValue("foldBraces", s.RemoveDeadCode);
section.SetAttributeValue("expandMemberDefinitions", s.ExpandMemberDefinitions);
section.SetAttributeValue("removeDeadCode", s.RemoveDeadCode);
section.SetAttributeValue("usingDeclarations", s.UsingDeclarations);
section.SetAttributeValue("fullyQualifyAmbiguousTypeNames", s.FullyQualifyAmbiguousTypeNames);
section.SetAttributeValue("alwaysUseBraces", s.AlwaysUseBraces);

9
ILSpy/Options/DisplaySettings.cs

@ -110,13 +110,10 @@ namespace ICSharpCode.ILSpy.Options @@ -110,13 +110,10 @@ namespace ICSharpCode.ILSpy.Options
bool sortResults = true;
public bool SortResults
{
public bool SortResults {
get { return sortResults; }
set
{
if (sortResults != value)
{
set {
if (sortResults != value) {
sortResults = value;
OnPropertyChanged();
}

2
ILSpy/Options/DisplaySettingsPanel.xaml

@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
<StackPanel Margin="3">
<CheckBox IsChecked="{Binding ShowLineNumbers}">Show line numbers</CheckBox>
<CheckBox IsChecked="{Binding ShowMetadataTokens}">Show metadata tokens</CheckBox>
<CheckBox IsChecked="{Binding EnableWordWrap}">Enable word wrap</CheckBox>
<CheckBox IsChecked="{Binding EnableWordWrap}">Enable word wrap</CheckBox>
<CheckBox IsChecked="{Binding SortResults}">Sort results by fitness</CheckBox>
</StackPanel>
</GroupBox>

6
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -102,8 +102,8 @@ namespace ICSharpCode.ILSpy.Options @@ -102,8 +102,8 @@ namespace ICSharpCode.ILSpy.Options
s.ShowLineNumbers = (bool?)e.Attribute("ShowLineNumbers") ?? false;
s.ShowMetadataTokens = (bool?) e.Attribute("ShowMetadataTokens") ?? false;
s.EnableWordWrap = (bool?)e.Attribute("EnableWordWrap") ?? false;
s.SortResults = (bool?)e.Attribute("SortResults") ?? false;
s.SortResults = (bool?)e.Attribute("SortResults") ?? true;
return s;
}
@ -118,7 +118,7 @@ namespace ICSharpCode.ILSpy.Options @@ -118,7 +118,7 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens);
section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap);
section.SetAttributeValue("SortResults", s.SortResults);
XElement existingElement = root.Element("DisplaySettings");
if (existingElement != null)
existingElement.ReplaceWith(section);

4
ILSpy/Properties/AssemblyInfo.template.cs

@ -39,10 +39,10 @@ using System.Diagnostics.CodeAnalysis; @@ -39,10 +39,10 @@ using System.Diagnostics.CodeAnalysis;
internal static class RevisionClass
{
public const string Major = "3";
public const string Minor = "0";
public const string Minor = "1";
public const string Build = "0";
public const string Revision = "$INSERTREVISION$";
public const string VersionName = "beta4";
public const string VersionName = "alpha1";
public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$";
}

2
ILSpy/SearchPane.cs

@ -216,7 +216,7 @@ namespace ICSharpCode.ILSpy @@ -216,7 +216,7 @@ namespace ICSharpCode.ILSpy
try {
var searcher = GetSearchStrategy(searchMode, searchTerm);
foreach (var loadedAssembly in assemblies) {
ModuleDefinition module = loadedAssembly.GetModuleDefinitionAsync().Result;
ModuleDefinition module = loadedAssembly.GetModuleDefinitionOrNull();
if (module == null)
continue;
CancellationToken cancellationToken = cts.Token;

19
ILSpy/SearchStrategies.cs

@ -139,12 +139,17 @@ namespace ICSharpCode.ILSpy @@ -139,12 +139,17 @@ namespace ICSharpCode.ILSpy
}
}
void Add<T>(IEnumerable<T> items, TypeDefinition type, Language language, Action<SearchResult> addResult, Func<T, Language, bool> matcher, Func<T, ImageSource> image) where T : MemberReference
void Add<T>(Func<IEnumerable<T>> itemsGetter, TypeDefinition type, Language language, Action<SearchResult> addResult, Func<T, Language, bool> matcher, Func<T, ImageSource> image) where T : MemberReference
{
IEnumerable<T> items = Enumerable.Empty<T>();
try {
items = itemsGetter();
} catch (Exception ex) {
System.Diagnostics.Debug.Print(ex.ToString());
}
foreach (var item in items) {
if (matcher(item, language)) {
addResult(new SearchResult
{
addResult(new SearchResult {
Member = item,
Fitness = CalculateFitness(item),
Image = image(item),
@ -158,10 +163,10 @@ namespace ICSharpCode.ILSpy @@ -158,10 +163,10 @@ namespace ICSharpCode.ILSpy
public virtual void Search(TypeDefinition type, Language language, Action<SearchResult> addResult)
{
Add(type.Fields, type, language, addResult, IsMatch, FieldTreeNode.GetIcon);
Add(type.Properties, type, language, addResult, IsMatch, p => PropertyTreeNode.GetIcon(p));
Add(type.Events, type, language, addResult, IsMatch, EventTreeNode.GetIcon);
Add(type.Methods.Where(NotSpecialMethod), type, language, addResult, IsMatch, MethodTreeNode.GetIcon);
Add(() => type.Fields, type, language, addResult, IsMatch, FieldTreeNode.GetIcon);
Add(() => type.Properties, type, language, addResult, IsMatch, p => PropertyTreeNode.GetIcon(p));
Add(() => type.Events, type, language, addResult, IsMatch, EventTreeNode.GetIcon);
Add(() => type.Methods.Where(NotSpecialMethod), type, language, addResult, IsMatch, MethodTreeNode.GetIcon);
foreach (TypeDefinition nestedType in type.NestedTypes) {
Search(nestedType, language, addResult);

2
ILSpy/TreeNodes/Analyzer/AnalyzerEntityTreeNode.cs

@ -38,7 +38,7 @@ namespace ICSharpCode.ILSpy.TreeNodes.Analyzer @@ -38,7 +38,7 @@ namespace ICSharpCode.ILSpy.TreeNodes.Analyzer
public override bool HandleAssemblyListChanged(ICollection<LoadedAssembly> removedAssemblies, ICollection<LoadedAssembly> addedAssemblies)
{
foreach (LoadedAssembly asm in removedAssemblies) {
if (this.Member.Module == asm.GetModuleDefinitionAsync().Result)
if (this.Member.Module == asm.GetModuleDefinitionOrNull())
return false; // remove this node
}
this.Children.RemoveAll(

2
ILSpy/TreeNodes/AssemblyListTreeNode.cs

@ -185,7 +185,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -185,7 +185,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
return null;
App.Current.Dispatcher.VerifyAccess();
foreach (AssemblyTreeNode node in this.Children) {
if (node.LoadedAssembly.IsLoaded && node.LoadedAssembly.GetModuleDefinitionAsync().Result == module)
if (node.LoadedAssembly.IsLoaded && node.LoadedAssembly.GetModuleDefinitionOrNull() == module)
return node;
}
return null;

2
ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -77,7 +77,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (assemblyListNode != null) {
var refNode = assemblyListNode.FindAssemblyNode(parentAssembly.LoadedAssembly.LookupReferencedAssembly(r));
if (refNode != null) {
ModuleDefinition module = refNode.LoadedAssembly.GetModuleDefinitionAsync().Result;
ModuleDefinition module = refNode.LoadedAssembly.GetModuleDefinitionOrNull();
if (module != null) {
foreach (var childRef in module.AssemblyReferences)
this.Children.Add(new AssemblyReferenceTreeNode(childRef, refNode));

7
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -145,7 +145,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -145,7 +145,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
protected override void LoadChildren()
{
ModuleDefinition moduleDefinition = assembly.GetModuleDefinitionAsync().Result;
ModuleDefinition moduleDefinition = assembly.GetModuleDefinitionOrNull();
if (moduleDefinition == null) {
// if we crashed on loading, then we don't have any children
return;
@ -396,8 +396,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -396,8 +396,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
return;
foreach (var node in context.SelectedTreeNodes) {
var la = ((AssemblyTreeNode)node).LoadedAssembly;
if (!la.HasLoadError) {
foreach (var assyRef in la.GetModuleDefinitionAsync().Result.AssemblyReferences) {
var module = la.GetModuleDefinitionOrNull();
if (module != null) {
foreach (var assyRef in module.AssemblyReferences) {
la.LookupReferencedAssembly(assyRef);
}
}

2
ILSpy/TreeNodes/DerivedTypesTreeNode.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -60,7 +60,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
IEnumerable<ILSpyTreeNode> FetchChildren(CancellationToken cancellationToken)
{
// FetchChildren() runs on the main thread; but the enumerator will be consumed on a background thread
var assemblies = list.GetAssemblies().Select(node => node.GetModuleDefinitionAsync().Result).Where(asm => asm != null).ToArray();
var assemblies = list.GetAssemblies().Select(node => node.GetModuleDefinitionOrNull()).Where(asm => asm != null).ToArray();
return FindDerivedTypes(type, assemblies, cancellationToken);
}

5
ILSpy/TreeNodes/EventTreeNode.cs

@ -73,8 +73,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -73,8 +73,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
case MethodAttributes.Public:
return AccessOverlayIcon.Public;
case MethodAttributes.Assembly:
case MethodAttributes.FamANDAssem:
return AccessOverlayIcon.Internal;
case MethodAttributes.FamANDAssem:
return AccessOverlayIcon.PrivateProtected;
case MethodAttributes.Family:
return AccessOverlayIcon.Protected;
case MethodAttributes.FamORAssem:
@ -90,6 +91,8 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -90,6 +91,8 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override FilterResult Filter(FilterSettings settings)
{
if (!settings.ShowInternalApi && !IsPublicAPI)
return FilterResult.Hidden;
if (settings.SearchTermMatches(EventDefinition.Name) && settings.Language.ShowMember(EventDefinition))
return FilterResult.Match;
else

5
ILSpy/TreeNodes/FieldTreeNode.cs

@ -87,8 +87,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -87,8 +87,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
case FieldAttributes.Public:
return AccessOverlayIcon.Public;
case FieldAttributes.Assembly:
case FieldAttributes.FamANDAssem:
return AccessOverlayIcon.Internal;
case FieldAttributes.FamANDAssem:
return AccessOverlayIcon.PrivateProtected;
case FieldAttributes.Family:
return AccessOverlayIcon.Protected;
case FieldAttributes.FamORAssem:
@ -104,6 +105,8 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -104,6 +105,8 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override FilterResult Filter(FilterSettings settings)
{
if (!settings.ShowInternalApi && !IsPublicAPI)
return FilterResult.Hidden;
if (settings.SearchTermMatches(FieldDefinition.Name) && settings.Language.ShowMember(FieldDefinition))
return FilterResult.Match;
else

5
ILSpy/TreeNodes/MethodTreeNode.cs

@ -104,8 +104,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -104,8 +104,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
case MethodAttributes.Public:
return AccessOverlayIcon.Public;
case MethodAttributes.Assembly:
case MethodAttributes.FamANDAssem:
return AccessOverlayIcon.Internal;
case MethodAttributes.FamANDAssem:
return AccessOverlayIcon.PrivateProtected;
case MethodAttributes.Family:
return AccessOverlayIcon.Protected;
case MethodAttributes.FamORAssem:
@ -126,6 +127,8 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -126,6 +127,8 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override FilterResult Filter(FilterSettings settings)
{
if (!settings.ShowInternalApi && !IsPublicAPI)
return FilterResult.Hidden;
if (settings.SearchTermMatches(MethodDefinition.Name) && settings.Language.ShowMember(MethodDefinition))
return FilterResult.Match;
else

5
ILSpy/TreeNodes/PropertyTreeNode.cs

@ -101,8 +101,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -101,8 +101,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
case MethodAttributes.Public:
return AccessOverlayIcon.Public;
case MethodAttributes.Assembly:
case MethodAttributes.FamANDAssem:
return AccessOverlayIcon.Internal;
case MethodAttributes.FamANDAssem:
return AccessOverlayIcon.PrivateProtected;
case MethodAttributes.Family:
return AccessOverlayIcon.Protected;
case MethodAttributes.FamORAssem:
@ -158,6 +159,8 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -158,6 +159,8 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override FilterResult Filter(FilterSettings settings)
{
if (!settings.ShowInternalApi && !IsPublicAPI)
return FilterResult.Hidden;
if (settings.SearchTermMatches(PropertyDefinition.Name) && settings.Language.ShowMember(PropertyDefinition))
return FilterResult.Match;
else

4
ILSpy/TreeNodes/TypeTreeNode.cs

@ -147,9 +147,11 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -147,9 +147,11 @@ namespace ICSharpCode.ILSpy.TreeNodes
break;
case TypeAttributes.NotPublic:
case TypeAttributes.NestedAssembly:
case TypeAttributes.NestedFamANDAssem:
overlay = AccessOverlayIcon.Internal;
break;
case TypeAttributes.NestedFamANDAssem:
overlay = AccessOverlayIcon.PrivateProtected;
break;
case TypeAttributes.NestedFamily:
case TypeAttributes.NestedFamORAssem:
overlay = AccessOverlayIcon.Protected;

2
TestPlugin/ContextMenuCommand.cs

@ -27,7 +27,7 @@ namespace TestPlugin @@ -27,7 +27,7 @@ namespace TestPlugin
if (context.SelectedTreeNodes == null)
return;
AssemblyTreeNode node = (AssemblyTreeNode)context.SelectedTreeNodes[0];
AssemblyDefinition asm = node.LoadedAssembly.GetAssemblyDefinitionAsync().Result;
AssemblyDefinition asm = node.LoadedAssembly.GetAssemblyDefinitionOrNull();
if (asm != null) {
SaveFileDialog dlg = new SaveFileDialog();
dlg.FileName = node.LoadedAssembly.FileName;

5
appveyor.yml

@ -31,8 +31,11 @@ for: @@ -31,8 +31,11 @@ for:
- branches:
only:
- master
- 3.0.x
artifacts:
- path: ILSpy_binaries.zip
name: ILSpy %APPVEYOR_REPO_BRANCH% %ILSPY_VERSION_NUMBER% binaries
- path: '**\*.vsix'
name: ILSpy AddIn for Visual Studio
- path: '**\*.nupkg'
name: ICSharpCode.Decompiler %APPVEYOR_REPO_BRANCH% %ILSPY_VERSION_NUMBER% NuGet
name: ICSharpCode.Decompiler %APPVEYOR_REPO_BRANCH% %ILSPY_VERSION_NUMBER% NuGet

29
preparerelease.bat

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
@setlocal enabledelayedexpansion
@set MSBUILD=
@for /D %%M in ("%ProgramFiles(x86)%\Microsoft Visual Studio\2017"\*) do (
@if exist "%%M\MSBuild\15.0\Bin\MSBuild.exe" (
@set "MSBUILD=%%M\MSBuild\15.0\Bin\MSBuild.exe"
)
)
@if "%MSBUILD%" == "" (
@echo Could not find VS2017 MSBuild
@exit /b 1
)
@del ICSharpCode.Decompiler\bin\Release\*.nupkg
"%MSBUILD%" ILSpy.sln /p:Configuration=Release "/p:Platform=Any CPU"
@IF %ERRORLEVEL% NEQ 0 (
@pause
@exit /b 1
)
@if not exist "%ProgramFiles%\7-zip\7z.exe" (
@echo Could not find 7zip
@exit /b 1
)
@del artifacts.zip
@rmdir /Q /S artifacts
@mkdir artifacts
"%ProgramFiles%\7-zip\7z.exe" a artifacts\ILSpy_binaries.zip %cd%\ILSpy\bin\Release\net46\*.dll %cd%\ILSpy\bin\Release\net46\*.exe %cd%\ILSpy\bin\Release\net46\*.config
@copy ILSpy.AddIn\bin\Release\net46\ILSpy.AddIn.vsix artifacts\
@copy ICSharpCode.Decompiler\bin\Release\*.nupkg artifacts\
"%ProgramFiles%\7-zip\7z.exe" a artifacts.zip %cd%\artifacts\*
@exit /b 0
Loading…
Cancel
Save