diff --git a/.editorconfig b/.editorconfig
index 496957673..6cae690bb 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,7 +8,9 @@ indent_size = 4
[*.il]
indent_style = space
indent_size = 2
-
+[*.{yml,yaml}]
+indent_style = space
+indent_size = 2
[*.csproj]
indent_style = space
indent_size = 2
diff --git a/.gitignore b/.gitignore
index 319f85b7f..e284b1638 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
bin/
obj/
-
+AppPackages/
+BundleArtifacts/
/ICSharpCode.Decompiler/Properties/AssemblyInfo.cs
/ILSpy/Properties/AssemblyInfo.cs
/ILSpy/app.config
diff --git a/BuildTools/pipelines-install.ps1 b/BuildTools/pipelines-install.ps1
new file mode 100644
index 000000000..31d5b634b
--- /dev/null
+++ b/BuildTools/pipelines-install.ps1
@@ -0,0 +1,40 @@
+$ErrorActionPreference = "Stop"
+
+$baseCommit = "d779383cb85003d6dabeb976f0845631e07bf463";
+$baseCommitRev = 1;
+
+# make sure this list matches artifacts-only branches list in azure-pipelines.yml!
+$masterBranches = @("master", "3.2.x");
+
+$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs";
+
+$versionParts = @{};
+Get-Content $globalAssemblyInfoTemplateFile | where { $_ -match 'string (\w+) = "?(\w+)"?;' } | foreach { $versionParts.Add($Matches[1], $Matches[2]) }
+
+$major = $versionParts.Major;
+$minor = $versionParts.Minor;
+$build = $versionParts.Build;
+$versionName = $versionParts.VersionName;
+
+if ($versionName -ne "null") {
+ $versionName = "-$versionName";
+} else {
+ $versionName = "";
+}
+if ($masterBranches -contains $env:BUILD_SOURCEBRANCHNAME) {
+ $branch = "";
+} else {
+ $branch = "-$env:BUILD_SOURCEBRANCHNAME";
+}
+if ($env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER) {
+ $suffix = "-pr$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER";
+} else {
+ $suffix = "";
+}
+
+$revision = [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev;
+
+$newVersion="$major.$minor.$build.$revision";
+$env:ILSPY_VERSION_NUMBER="$newVersion$branch$versionName$suffix";
+Write-Host "##vso[build.updatebuildnumber]$newVersion$branch$versionName$suffix";
+Write-Host "new version: $newVersion$branch$versionName$suffix";
\ No newline at end of file
diff --git a/BuildTools/tidy.py b/BuildTools/tidy.py
index 5f732ce7c..3a0ba3756 100644
--- a/BuildTools/tidy.py
+++ b/BuildTools/tidy.py
@@ -22,7 +22,7 @@ def main():
if '\\obj\\' in root:
continue
for filename in files:
- if filename.lower().endswith('.cs'):
+ if filename.lower().endswith('.cs') and not filename.lower().endswith('resources.designer.cs'):
if not check(os.path.join(root, filename)):
ok = False
print('Tidy check: {}'.format('successful' if ok else 'failed'))
diff --git a/BuildTools/update-assemblyinfo.ps1 b/BuildTools/update-assemblyinfo.ps1
index e304522a8..d901e7fea 100644
--- a/BuildTools/update-assemblyinfo.ps1
+++ b/BuildTools/update-assemblyinfo.ps1
@@ -57,8 +57,10 @@ function gitBranch() {
return "no-branch";
}
- if ($env:APPVEYOR_REPO_BRANCH -ne $null) {
+ if ($env:APPVEYOR_REPO_BRANCH -ne $null) {
return $env:APPVEYOR_REPO_BRANCH;
+ } elseif ($env:BUILD_SOURCEBRANCHNAME -ne $null) {
+ return $env:BUILD_SOURCEBRANCHNAME;
} else {
return ((git branch --no-color).Split([System.Environment]::NewLine) | where { $_ -match "^\* " } | select -First 1).Substring(2);
}
@@ -71,6 +73,12 @@ $templateFiles = (
@{Input="ILSpy/Properties/app.config.template"; Output = "ILSpy/app.config"},
@{Input="ILSpy.AddIn/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn/source.extension.vsixmanifest"}
);
+
+$appxmanifestFiles = (
+ @{Input="ILSpy.Package/Package.appxmanifest"; Output="ILSpy.Package/Package.appxmanifest"},
+ @{Input="ILSpy.Package/Package-CI.appxmanifest"; Output="ILSpy.Package/Package-CI.appxmanifest"}
+);
+
[string]$mutexId = "ILSpyUpdateAssemblyInfo" + (Get-Location).ToString().GetHashCode();
Write-Host $mutexId;
[bool]$createdNew = $false;
@@ -142,6 +150,32 @@ try {
$out | Out-File -Encoding utf8 $file.Output;
}
}
+
+ # Only update these on the Build Agent when ReleaseChannel is set
+ if($Env:ReleaseChannel -ne '' -and $Env:ReleaseChannel -ne $null) {
+ foreach ($file in $appxmanifestFiles) {
+ [string]$in = (Get-Content $file.Input) -Join [System.Environment]::NewLine;
+
+ $out = $in.Replace('$INSERTVERSION$', $fullVersionNumber);
+ $out = $out.Replace('$INSERTMAJORVERSION$', $major);
+ $out = $out.Replace('$INSERTMINORVERSION$', $minor);
+ $out = $out.Replace('$INSERTREVISION$', $revision);
+ $out = $out.Replace('$INSERTCOMMITHASH$', $gitCommitHash);
+ $out = $out.Replace('$INSERTSHORTCOMMITHASH$', $gitCommitHash.Substring(0, 8));
+ $out = $out.Replace('$INSERTDATE$', [System.DateTime]::Now.ToString("MM/dd/yyyy"));
+ $out = $out.Replace('$INSERTYEAR$', [System.DateTime]::Now.Year.ToString());
+ $out = $out.Replace('$INSERTBRANCHNAME$', $branchName);
+ $out = $out.Replace('$INSERTBRANCHPOSTFIX$', $postfixBranchName);
+ $out = $out.Replace('$INSERTVERSIONNAME$', $versionName);
+ $out = $out.Replace('$INSERTVERSIONNAMEPOSTFIX$', $postfixVersionName);
+ $out = $out.Replace('$INSERTBUILDCONFIG$', $buildConfig);
+
+ if (((Get-Content $file.Input) -Join [System.Environment]::NewLine) -ne $out) {
+ $out | Out-File -Encoding utf8 $file.Output;
+ }
+ }
+ }
+
} finally {
$mutex.ReleaseMutex();
$mutex.Close();
diff --git a/DecompilerNuGetDemos.workbook b/DecompilerNuGetDemos.workbook
index 0adb88217..0d4e3d504 100644
--- a/DecompilerNuGetDemos.workbook
+++ b/DecompilerNuGetDemos.workbook
@@ -6,7 +6,7 @@ platforms:
- DotNetCore
packages:
- id: ICSharpCode.Decompiler
- version: 4.0.0.4521
+ version: 5.0.0.5124
---
Setup: load the references required to work with the decompiler
diff --git a/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj b/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
index cf29288d1..5f3e7a298 100644
--- a/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
+++ b/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
@@ -7,7 +7,7 @@
true
ilspycmd
ilspycmd
- 4.0
+ 5.0.0.5124
Command-line decompiler using the ILSpy decompilation engine
Copyright 2011-2019 AlphaSierraPapa
https://github.com/icsharpcode/ILSpy/
@@ -15,9 +15,10 @@
https://ilspy.net/images/icon32.png
https://github.com/icsharpcode/ILSpy/
- 4.0.0.0
- 4.0.0.0
+ 5.0.0.0
+ 5.0.0.0
true
+ ILSpy Team
@@ -27,7 +28,7 @@
-
+
diff --git a/ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs b/ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs
index dfe089918..3adfe47c0 100644
--- a/ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs
+++ b/ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs
@@ -46,7 +46,7 @@ Remarks:
public bool ShowILCodeFlag { get; }
[Option("-d|--debuginfo", "Generate PDB.", CommandOptionType.NoValue)]
- public bool CreteDebugInfoFlag { get; }
+ public bool CreateDebugInfoFlag { get; }
[Option("-l|--list ", "Lists all entities of the specified type(s). Valid types: c(lass), i(interface), s(truct), d(elegate), e(num)", CommandOptionType.MultipleValue)]
public string[] EntityTypes { get; } = new string[0];
@@ -54,6 +54,10 @@ Remarks:
[Option("-v|--version", "Show version of ICSharpCode.Decompiler used.", CommandOptionType.NoValue)]
public bool ShowVersion { get; }
+ [DirectoryExists]
+ [Option("-r|--referencepath ", "Path to a directory containing dependencies of the assembly that is being decompiled.", CommandOptionType.MultipleValue)]
+ public string[] ReferencePaths { get; } = new string[0];
+
private int OnExecute(CommandLineApplication app)
{
TextWriter output = System.Console.Out;
@@ -61,7 +65,7 @@ Remarks:
try {
if (CreateCompilableProjectFlag) {
- DecompileAsProject(InputAssemblyName, OutputDirectory);
+ DecompileAsProject(InputAssemblyName, OutputDirectory, ReferencePaths);
} else if (EntityTypes.Any()) {
var values = EntityTypes.SelectMany(v => v.Split(',', ';')).ToArray();
HashSet kinds = TypesParser.ParseSelection(values);
@@ -70,15 +74,15 @@ Remarks:
output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".list.txt");
}
- ListContent(InputAssemblyName, output, kinds);
+ ListContent(InputAssemblyName, output, kinds, ReferencePaths);
} else if (ShowILCodeFlag) {
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".il");
}
- ShowIL(InputAssemblyName, output);
- } else if (CreteDebugInfoFlag) {
+ ShowIL(InputAssemblyName, output, ReferencePaths);
+ } else if (CreateDebugInfoFlag) {
string pdbFileName = null;
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
@@ -87,7 +91,7 @@ Remarks:
pdbFileName = Path.ChangeExtension(InputAssemblyName, ".pdb");
}
- return GeneratePdbForAssembly(InputAssemblyName, pdbFileName, app);
+ return GeneratePdbForAssembly(InputAssemblyName, pdbFileName, ReferencePaths, app);
} else if (ShowVersion) {
string vInfo = "ilspycmd: " + typeof(ILSpyCmdProgram).Assembly.GetName().Version.ToString() +
Environment.NewLine
@@ -101,7 +105,7 @@ Remarks:
(String.IsNullOrEmpty(TypeName) ? outputName : TypeName) + ".decompiled.cs"));
}
- Decompile(InputAssemblyName, output, TypeName);
+ Decompile(InputAssemblyName, output, ReferencePaths, TypeName);
}
} catch (Exception ex) {
app.Error.WriteLine(ex.ToString());
@@ -113,14 +117,19 @@ Remarks:
return 0;
}
- static CSharpDecompiler GetDecompiler(string assemblyFileName)
+ static CSharpDecompiler GetDecompiler(string assemblyFileName, string[] referencePaths)
{
- return new CSharpDecompiler(assemblyFileName, new DecompilerSettings() { ThrowOnAssemblyResolveErrors = false });
+ var module = new PEFile(assemblyFileName);
+ var resolver = new UniversalAssemblyResolver(assemblyFileName, false, module.Reader.DetectTargetFrameworkId());
+ foreach (var path in referencePaths) {
+ resolver.AddSearchDirectory(path);
+ }
+ return new CSharpDecompiler(assemblyFileName, resolver, new DecompilerSettings());
}
- static void ListContent(string assemblyFileName, TextWriter output, ISet kinds)
+ static void ListContent(string assemblyFileName, TextWriter output, ISet kinds, string[] referencePaths)
{
- CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
+ CSharpDecompiler decompiler = GetDecompiler(assemblyFileName, referencePaths);
foreach (var type in decompiler.TypeSystem.MainModule.TypeDefinitions) {
if (!kinds.Contains(type.Kind))
@@ -129,9 +138,9 @@ Remarks:
}
}
- static void ShowIL(string assemblyFileName, TextWriter output)
+ static void ShowIL(string assemblyFileName, TextWriter output, string[] referencePaths)
{
- CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
+ CSharpDecompiler decompiler = GetDecompiler(assemblyFileName, referencePaths);
ITextOutput textOutput = new PlainTextOutput();
ReflectionDisassembler disassembler = new ReflectionDisassembler(textOutput, CancellationToken.None);
@@ -143,17 +152,21 @@ Remarks:
output.WriteLine(textOutput.ToString());
}
- static void DecompileAsProject(string assemblyFileName, string outputDirectory)
+ static void DecompileAsProject(string assemblyFileName, string outputDirectory, string[] referencePaths)
{
- WholeProjectDecompiler decompiler = new WholeProjectDecompiler();
+ var decompiler = new WholeProjectDecompiler();
var module = new PEFile(assemblyFileName);
- decompiler.AssemblyResolver = new UniversalAssemblyResolver(assemblyFileName, false, module.Reader.DetectTargetFrameworkId());
+ var resolver = new UniversalAssemblyResolver(assemblyFileName, false, module.Reader.DetectTargetFrameworkId());
+ foreach (var path in referencePaths) {
+ resolver.AddSearchDirectory(path);
+ }
+ decompiler.AssemblyResolver = resolver;
decompiler.DecompileProject(module, outputDirectory);
}
- static void Decompile(string assemblyFileName, TextWriter output, string typeName = null)
+ static void Decompile(string assemblyFileName, TextWriter output, string[] referencePaths, string typeName = null)
{
- CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
+ CSharpDecompiler decompiler = GetDecompiler(assemblyFileName, referencePaths);
if (typeName == null) {
output.Write(decompiler.DecompileWholeModuleAsString());
@@ -163,7 +176,7 @@ Remarks:
}
}
- static int GeneratePdbForAssembly(string assemblyFileName, string pdbFileName, CommandLineApplication app)
+ static int GeneratePdbForAssembly(string assemblyFileName, string pdbFileName, string[] referencePaths, CommandLineApplication app)
{
var module = new PEFile(assemblyFileName,
new FileStream(assemblyFileName, FileMode.Open, FileAccess.Read),
@@ -176,7 +189,7 @@ Remarks:
}
using (FileStream stream = new FileStream(pdbFileName, FileMode.OpenOrCreate, FileAccess.Write)) {
- var decompiler = GetDecompiler(assemblyFileName);
+ var decompiler = GetDecompiler(assemblyFileName, referencePaths);
PortablePdbWriter.WritePdb(module, decompiler, new DecompilerSettings() { ThrowOnAssemblyResolveErrors = false }, stream);
}
diff --git a/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj b/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj
index 514c347a6..4b621af3b 100644
--- a/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj
+++ b/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs b/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs
index 01f85c743..6d75516da 100644
--- a/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs
@@ -196,12 +196,6 @@ namespace ICSharpCode.Decompiler.Tests
RunCS(options: options);
}
- [Test]
- public void RefLocalsAndReturns([ValueSource("roslynOnlyOptions")] CompilerOptions options)
- {
- RunCS(options: options);
- }
-
[Test]
public void BitNot([Values(false, true)] bool force32Bit)
{
@@ -295,12 +289,6 @@ namespace ICSharpCode.Decompiler.Tests
RunCS(options: options);
}
- [Test]
- public void LocalFunctions([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions options)
- {
- RunCS(options: options);
- }
-
void RunCS([CallerMemberName] string testName = null, CompilerOptions options = CompilerOptions.UseDebug)
{
string testFileName = testName + ".cs";
@@ -329,8 +317,8 @@ namespace ICSharpCode.Decompiler.Tests
Tester.RunAndCompareOutput(testFileName, outputFile.PathToAssembly, decompiledOutputFile.PathToAssembly, decompiledCodeFile);
- File.Delete(decompiledCodeFile);
- File.Delete(decompiledOutputFile.PathToAssembly);
+ Tester.RepeatOnIOError(() => File.Delete(decompiledCodeFile));
+ Tester.RepeatOnIOError(() => File.Delete(decompiledOutputFile.PathToAssembly));
} finally {
if (outputFile != null)
outputFile.TempFiles.Delete();
@@ -341,6 +329,7 @@ namespace ICSharpCode.Decompiler.Tests
void RunVB([CallerMemberName] string testName = null, CompilerOptions options = CompilerOptions.UseDebug)
{
+ options |= CompilerOptions.ReferenceVisualBasic;
string testFileName = testName + ".vb";
string testOutputFileName = testName + Tester.GetSuffix(options) + ".exe";
CompilerResults outputFile = null, decompiledOutputFile = null;
@@ -353,8 +342,8 @@ namespace ICSharpCode.Decompiler.Tests
Tester.RunAndCompareOutput(testFileName, outputFile.PathToAssembly, decompiledOutputFile.PathToAssembly, decompiledCodeFile);
- File.Delete(decompiledCodeFile);
- File.Delete(decompiledOutputFile.PathToAssembly);
+ Tester.RepeatOnIOError(() => File.Delete(decompiledCodeFile));
+ Tester.RepeatOnIOError(() => File.Delete(decompiledOutputFile.PathToAssembly));
} finally {
if (outputFile != null)
outputFile.TempFiles.Delete();
@@ -374,9 +363,9 @@ namespace ICSharpCode.Decompiler.Tests
decompiledOutputFile = Tester.CompileCSharp(decompiledCodeFile, options);
Tester.RunAndCompareOutput(testFileName, outputFile, decompiledOutputFile.PathToAssembly, decompiledCodeFile);
-
- File.Delete(decompiledCodeFile);
- File.Delete(decompiledOutputFile.PathToAssembly);
+
+ Tester.RepeatOnIOError(() => File.Delete(decompiledCodeFile));
+ Tester.RepeatOnIOError(() => File.Delete(decompiledOutputFile.PathToAssembly));
} finally {
if (decompiledOutputFile != null)
decompiledOutputFile.TempFiles.Delete();
diff --git a/ICSharpCode.Decompiler.Tests/Helpers/CodeAssert.cs b/ICSharpCode.Decompiler.Tests/Helpers/CodeAssert.cs
index 1d325ffcb..84150206a 100644
--- a/ICSharpCode.Decompiler.Tests/Helpers/CodeAssert.cs
+++ b/ICSharpCode.Decompiler.Tests/Helpers/CodeAssert.cs
@@ -36,44 +36,72 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
);
var alignedDiff = Diff.AlignElements(collection1, collection2, diffSections, new StringSimilarityDiffElementAligner());
- bool result = true, ignoreChange;
-
+ bool result = true;
int line1 = 0, line2 = 0;
-
+ const int contextSize = 10;
+ int consecutiveMatches = contextSize;
+ var hiddenMatches = new List();
+
foreach (var change in alignedDiff) {
-
switch (change.Operation) {
case DiffOperation.Match:
- diff.Write("{0,4} {1,4} ", ++line1, ++line2);
- diff.Write(" ");
- diff.WriteLine(change.ElementFromCollection1.Value);
+ AppendMatch($"{++line1,4} {++line2,4} ", change.ElementFromCollection1.Value);
break;
case DiffOperation.Insert:
- diff.Write(" {1,4} ", line1, ++line2);
- result &= ignoreChange = ShouldIgnoreChange(change.ElementFromCollection2.Value);
- diff.Write(ignoreChange ? " " : " + ");
- diff.WriteLine(change.ElementFromCollection2.Value);
+ string pos = $" {++line2,4} ";
+ if (ShouldIgnoreChange(change.ElementFromCollection2.Value)) {
+ AppendMatch(pos, change.ElementFromCollection2.Value);
+ } else {
+ AppendDelta(pos, " + ", change.ElementFromCollection2.Value);
+ result = false;
+ }
break;
case DiffOperation.Delete:
- diff.Write("{0,4} ", ++line1, line2);
- result &= ignoreChange = ShouldIgnoreChange(change.ElementFromCollection1.Value);
- diff.Write(ignoreChange ? " " : " - ");
- diff.WriteLine(change.ElementFromCollection1.Value);
+ pos = $"{++line1,4} ";
+ if (ShouldIgnoreChange(change.ElementFromCollection1.Value)) {
+ AppendMatch(pos, change.ElementFromCollection1.Value);
+ } else {
+ AppendDelta(pos, " - ", change.ElementFromCollection1.Value);
+ result = false;
+ }
break;
case DiffOperation.Modify:
case DiffOperation.Replace:
- diff.Write("{0,4} ", ++line1, line2);
+ AppendDelta($"{++line1,4} ", "(-)", change.ElementFromCollection1.Value);
+ AppendDelta($" {++line2,4} ", "(+)", change.ElementFromCollection2.Value);
result = false;
- diff.Write("(-) ");
- diff.WriteLine(change.ElementFromCollection1.Value);
- diff.Write(" {1,4} ", line1, ++line2);
- diff.Write("(+) ");
- diff.WriteLine(change.ElementFromCollection2.Value);
break;
}
}
+ if (hiddenMatches.Count > 0) {
+ diff.WriteLine(" ...");
+ }
return result;
+
+ void AppendMatch(string pos, string code)
+ {
+ consecutiveMatches++;
+ if (consecutiveMatches > contextSize) {
+ // hide this match
+ hiddenMatches.Add(pos + " " + code);
+ } else {
+ diff.WriteLine(pos + " " + code);
+ }
+ }
+
+ void AppendDelta(string pos, string changeType, string code)
+ {
+ consecutiveMatches = 0;
+ if (hiddenMatches.Count > contextSize) {
+ diff.WriteLine(" ...");
+ }
+ for (int i = Math.Max(0, hiddenMatches.Count - contextSize); i < hiddenMatches.Count; i++) {
+ diff.WriteLine(hiddenMatches[i]);
+ }
+ hiddenMatches.Clear();
+ diff.WriteLine(pos + changeType + " " + code);
+ }
}
class CodeLineEqualityComparer : IEqualityComparer
diff --git a/ICSharpCode.Decompiler.Tests/Helpers/RemoveCompilerAttribute.cs b/ICSharpCode.Decompiler.Tests/Helpers/RemoveCompilerAttribute.cs
index 3231e7f96..214dda115 100644
--- a/ICSharpCode.Decompiler.Tests/Helpers/RemoveCompilerAttribute.cs
+++ b/ICSharpCode.Decompiler.Tests/Helpers/RemoveCompilerAttribute.cs
@@ -33,11 +33,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
}
}
- public class RemoveEmbeddedAtttributes : DepthFirstAstVisitor, IAstTransform
+ public class RemoveEmbeddedAttributes : DepthFirstAstVisitor, IAstTransform
{
HashSet attributeNames = new HashSet() {
"System.Runtime.CompilerServices.IsReadOnlyAttribute",
"System.Runtime.CompilerServices.IsByRefLikeAttribute",
+ "System.Runtime.CompilerServices.IsUnmanagedAttribute",
+ "System.Runtime.CompilerServices.NullableAttribute",
+ "System.Runtime.CompilerServices.NullableContextAttribute",
"Microsoft.CodeAnalysis.EmbeddedAttribute",
};
diff --git a/ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs b/ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs
index b543842f8..55f0f5a3e 100644
--- a/ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs
+++ b/ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
+using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.VisualBasic;
@@ -26,8 +27,12 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
if (flags.HasFlag(CompilerOptions.UseRoslyn)) {
var parseOptions = new VisualBasicParseOptions(preprocessorSymbols: preprocessorSymbols, languageVersion: LanguageVersion.Latest);
var syntaxTrees = sourceFileNames.Select(f => SyntaxFactory.ParseSyntaxTree(File.ReadAllText(f), parseOptions, path: f));
+ var references = defaultReferences.Value;
+ if (flags.HasFlag(CompilerOptions.ReferenceVisualBasic)) {
+ references = references.Concat(visualBasic.Value);
+ }
var compilation = VisualBasicCompilation.Create(Path.GetFileNameWithoutExtension(sourceFileName),
- syntaxTrees, defaultReferences.Value,
+ syntaxTrees, references,
new VisualBasicCompilationOptions(
flags.HasFlag(CompilerOptions.Library) ? OutputKind.DynamicallyLinkedLibrary : OutputKind.ConsoleApplication,
platform: flags.HasFlag(CompilerOptions.Force32Bit) ? Platform.X86 : Platform.AnyCpu,
@@ -51,10 +56,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var provider = new VBCodeProvider(new Dictionary { { "CompilerVersion", "v4.0" } });
CompilerParameters options = new CompilerParameters();
options.GenerateExecutable = !flags.HasFlag(CompilerOptions.Library);
- options.CompilerOptions = "/o" + (flags.HasFlag(CompilerOptions.Optimize) ? "+" : "-");
+ options.CompilerOptions = "/optimize" + (flags.HasFlag(CompilerOptions.Optimize) ? "+" : "-");
options.CompilerOptions += (flags.HasFlag(CompilerOptions.UseDebug) ? " /debug" : "");
options.CompilerOptions += (flags.HasFlag(CompilerOptions.Force32Bit) ? " /platform:anycpu32bitpreferred" : "");
- options.CompilerOptions += "/optioninfer+ /optionexplicit+";
+ options.CompilerOptions += " /optioninfer+ /optionexplicit+";
if (preprocessorSymbols.Count > 0) {
options.CompilerOptions += " /d:" + string.Join(",", preprocessorSymbols.Select(p => $"{p.Key}={p.Value}"));
}
@@ -65,7 +70,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
options.ReferencedAssemblies.Add("System.dll");
options.ReferencedAssemblies.Add("System.Core.dll");
options.ReferencedAssemblies.Add("System.Xml.dll");
- options.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll");
+ if (flags.HasFlag(CompilerOptions.ReferenceVisualBasic)) {
+ options.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll");
+ }
CompilerResults results = provider.CompileAssemblyFromFile(options, sourceFileNames.ToArray());
if (results.Errors.Cast().Any(e => !e.IsWarning)) {
StringBuilder b = new StringBuilder("Compiler error:");
diff --git a/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs b/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
index 0d880922d..250b2f1ef 100644
--- a/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
+++ b/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
@@ -54,6 +54,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
Library = 0x8,
UseRoslyn = 0x10,
UseMcs = 0x20,
+ ReferenceVisualBasic = 0x40,
}
[Flags]
@@ -181,23 +182,32 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
return Regex.Replace(il, @"'\{[0-9A-F-]+\}'", "''");
}
+ static readonly string refAsmPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
+ @"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2");
+ static readonly string thisAsmPath = Path.GetDirectoryName(typeof(Tester).Assembly.Location);
+
static readonly Lazy> defaultReferences = new Lazy>(delegate {
- string refAsmPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
- @"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5");
return new[]
{
+ MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "Facades\\netstandard.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "mscorlib.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Core.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, @"Facades\System.Runtime.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Xml.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "Microsoft.CSharp.dll")),
- MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "Microsoft.VisualBasic.dll")),
MetadataReference.CreateFromFile(typeof(ValueTuple).Assembly.Location),
+ MetadataReference.CreateFromFile(typeof(ValueTask).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Span<>).Assembly.Location),
};
});
+ static readonly Lazy> visualBasic = new Lazy>(delegate {
+ return new[] {
+ MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "Microsoft.VisualBasic.dll"))
+ };
+ });
+
public static List GetPreprocessorSymbols(CompilerOptions flags)
{
var preprocessorSymbols = new List();
@@ -236,10 +246,17 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var preprocessorSymbols = GetPreprocessorSymbols(flags);
if (flags.HasFlag(CompilerOptions.UseRoslyn)) {
- var parseOptions = new CSharpParseOptions(preprocessorSymbols: preprocessorSymbols.ToArray(), languageVersion: Microsoft.CodeAnalysis.CSharp.LanguageVersion.Latest);
+ var parseOptions = new CSharpParseOptions(
+ preprocessorSymbols: preprocessorSymbols.ToArray(),
+ languageVersion: Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp8
+ );
var syntaxTrees = sourceFileNames.Select(f => SyntaxFactory.ParseSyntaxTree(File.ReadAllText(f), parseOptions, path: f));
+ var references = defaultReferences.Value;
+ if (flags.HasFlag(CompilerOptions.ReferenceVisualBasic)) {
+ references = references.Concat(visualBasic.Value);
+ }
var compilation = CSharpCompilation.Create(Path.GetFileNameWithoutExtension(sourceFileName),
- syntaxTrees, defaultReferences.Value,
+ syntaxTrees, references,
new CSharpCompilationOptions(
flags.HasFlag(CompilerOptions.Library) ? OutputKind.DynamicallyLinkedLibrary : OutputKind.ConsoleApplication,
platform: flags.HasFlag(CompilerOptions.Force32Bit) ? Platform.X86 : Platform.AnyCpu,
@@ -326,7 +343,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
options.ReferencedAssemblies.Add("System.Core.dll");
options.ReferencedAssemblies.Add("System.Xml.dll");
options.ReferencedAssemblies.Add("Microsoft.CSharp.dll");
- options.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll");
+ if (flags.HasFlag(CompilerOptions.ReferenceVisualBasic)) {
+ options.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll");
+ }
CompilerResults results = provider.CompileAssemblyFromFile(options, sourceFileNames.ToArray());
if (results.Errors.Cast().Any(e => !e.IsWarning)) {
StringBuilder b = new StringBuilder("Compiler error:");
@@ -431,10 +450,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
resolver.AddSearchDirectory(Path.GetDirectoryName(typeof(Span<>).Assembly.Location));
var typeSystem = new DecompilerTypeSystem(module, resolver, settings);
CSharpDecompiler decompiler = new CSharpDecompiler(typeSystem, settings);
- decompiler.AstTransforms.Insert(0, new RemoveEmbeddedAtttributes());
+ decompiler.AstTransforms.Insert(0, new RemoveEmbeddedAttributes());
decompiler.AstTransforms.Insert(0, new RemoveCompilerAttribute());
decompiler.AstTransforms.Add(new EscapeInvalidIdentifiers());
- var syntaxTree = decompiler.DecompileWholeModuleAsSingleFile();
+ var syntaxTree = decompiler.DecompileWholeModuleAsSingleFile(sortTypes: true);
StringWriter output = new StringWriter();
var visitor = new CSharpOutputVisitor(output, FormattingOptionsFactory.CreateSharpDevelop());
@@ -500,5 +519,43 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
Assert.Fail(b.ToString());
}
}
+
+ internal static void RepeatOnIOError(Action action, int numTries = 5)
+ {
+ for (int i = 0; i < numTries - 1; i++) {
+ try {
+ action();
+ return;
+ } catch (IOException) {
+ } catch (UnauthorizedAccessException) {
+ // potential virus scanner problem
+ }
+ Thread.Sleep(10);
+ }
+ // If the last try still fails, don't catch the exception
+ action();
+ }
+
+ public static void SignAssembly(string assemblyPath, string keyFilePath)
+ {
+ string snPath = SdkUtility.GetSdkPath("sn.exe");
+
+ ProcessStartInfo info = new ProcessStartInfo(snPath);
+ info.Arguments = $"-R \"{assemblyPath}\" \"{keyFilePath}\"";
+ info.RedirectStandardError = true;
+ info.RedirectStandardOutput = true;
+ info.UseShellExecute = false;
+
+ Process process = Process.Start(info);
+
+ var outputTask = process.StandardOutput.ReadToEndAsync();
+ var errorTask = process.StandardError.ReadToEndAsync();
+
+ Task.WaitAll(outputTask, errorTask);
+ process.WaitForExit();
+
+ Console.WriteLine("output: " + outputTask.Result);
+ Console.WriteLine("errors: " + errorTask.Result);
+ }
}
}
diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
index b899c371b..1f7b27189 100644
--- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
+++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
@@ -2,12 +2,12 @@
- net462
+ net472
7.3
True
- 1701;1702;1705,67,169,1058,728,1720,649,168,251
+ 1701;1702;1705,67,169,1058,728,1720,649,168,251,660,661,675
False
@@ -32,18 +32,23 @@
- TRACE;DEBUG;NET46;ROSLYN;CS60;CS70
+ TRACE;DEBUG;NET46;ROSLYN;CS60;CS70;CS71;CS72;CS73
+
+
+
+ TRACE;NET46;ROSLYN;CS60;CS70;CS71;CS72;CS73
-
-
+
+
+
-
+
-
-
+
+
@@ -55,11 +60,18 @@
+
+
+
+
+
+
+
@@ -67,19 +79,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
@@ -219,6 +246,7 @@
+
diff --git a/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
index 6bc796546..a709794f8 100644
--- a/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
@@ -58,6 +58,12 @@ namespace ICSharpCode.Decompiler.Tests
Run();
}
+ [Test]
+ public void Issue684()
+ {
+ Run();
+ }
+
[Test]
public void Issue959()
{
@@ -91,13 +97,19 @@ namespace ICSharpCode.Decompiler.Tests
[Test]
public void FSharpUsing_Debug()
{
- Run(settings: new DecompilerSettings { RemoveDeadCode = true });
+ Run(settings: new DecompilerSettings { RemoveDeadStores = true });
}
[Test]
public void FSharpUsing_Release()
{
- Run(settings: new DecompilerSettings { RemoveDeadCode = true });
+ Run(settings: new DecompilerSettings { RemoveDeadStores = true });
+ }
+
+ [Test]
+ public void DirectCallToExplicitInterfaceImpl()
+ {
+ Run();
}
[Test]
@@ -142,24 +154,48 @@ namespace ICSharpCode.Decompiler.Tests
Run();
}
+ [Test]
+ public void Issue1681()
+ {
+ Run();
+ }
+
+ [Test]
+ public void Issue1454()
+ {
+ Run();
+ }
+
+ [Test]
+ public void ConstantBlobs()
+ {
+ Run();
+ }
+
[Test]
public void SequenceOfNestedIfs()
{
Run();
}
+ [Test]
+ public void Unsafe()
+ {
+ Run();
+ }
+
[Test]
public void FSharpLoops_Debug()
{
CopyFSharpCoreDll();
- Run(settings: new DecompilerSettings { RemoveDeadCode = true });
+ Run(settings: new DecompilerSettings { RemoveDeadStores = true });
}
[Test]
public void FSharpLoops_Release()
{
CopyFSharpCoreDll();
- Run(settings: new DecompilerSettings { RemoveDeadCode = true });
+ Run(settings: new DecompilerSettings { RemoveDeadStores = true });
}
void Run([CallerMemberName] string testName = null, DecompilerSettings settings = null)
diff --git a/ICSharpCode.Decompiler.Tests/PdbGenerationTestRunner.cs b/ICSharpCode.Decompiler.Tests/PdbGenerationTestRunner.cs
index c13ee99a0..78de11172 100644
--- a/ICSharpCode.Decompiler.Tests/PdbGenerationTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/PdbGenerationTestRunner.cs
@@ -18,7 +18,7 @@ using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests
{
- [TestFixture]
+ [TestFixture, Parallelizable(ParallelScope.All)]
public class PdbGenerationTestRunner
{
static readonly string TestCasePath = Tester.TestCasePath + "/PdbGen";
diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
index c9b708841..4a34baaf9 100644
--- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
@@ -114,7 +114,7 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
NullPropagation = false,
// legacy csc generates a dead store in debug builds
- RemoveDeadCode = (cscOptions == CompilerOptions.None)
+ RemoveDeadStores = (cscOptions == CompilerOptions.None)
});
}
@@ -123,7 +123,7 @@ namespace ICSharpCode.Decompiler.Tests
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
// legacy csc generates a dead store in debug builds
- RemoveDeadCode = (cscOptions == CompilerOptions.None)
+ RemoveDeadStores = (cscOptions == CompilerOptions.None)
});
}
@@ -134,7 +134,7 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void DelegateConstruction([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
+ public void DelegateConstruction([ValueSource(nameof(defaultOptionsWithMcs))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
@@ -180,10 +180,16 @@ namespace ICSharpCode.Decompiler.Tests
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
// legacy csc generates a dead store in debug builds
- RemoveDeadCode = (cscOptions == CompilerOptions.None)
+ RemoveDeadStores = (cscOptions == CompilerOptions.None)
});
}
+ [Test]
+ public void LocalFunctions([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
[Test]
public void PropertiesAndEvents([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
@@ -233,6 +239,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions, asmOptions: AssemblerOptions.UseOwnDisassembler);
}
+ [Test]
+ public void OutVariables([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
[Test]
public void InitializerTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
@@ -252,13 +264,12 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void FixProxyCalls([Values(CompilerOptions.None, CompilerOptions.Optimize, CompilerOptions.UseRoslyn)] CompilerOptions cscOptions)
+ public void FixProxyCalls([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- [Ignore("Special cases not implemented in new decompiler.")]
public void ValueTypes([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
@@ -273,7 +284,9 @@ namespace ICSharpCode.Decompiler.Tests
[Test]
public void VariableNamingWithoutSymbols([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
- RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { UseDebugSymbols = false });
+ var settings = Tester.GetSettings(cscOptions);
+ settings.UseDebugSymbols = false;
+ RunForLibrary(cscOptions: cscOptions, decompilerSettings: settings);
}
[Test]
@@ -288,6 +301,18 @@ namespace ICSharpCode.Decompiler.Tests
Run(cscOptions: cscOptions);
}
+ [Test]
+ public void CustomTaskType([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
+ [Test]
+ public void NullableRefTypes([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
[Test]
public void NullPropagation([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{
@@ -312,6 +337,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions);
}
+ [Test]
+ public void ThrowExpressions([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
[Test]
public void WellKnownConstants([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
@@ -415,7 +446,19 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void YieldReturn([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
+ public void YieldReturn([ValueSource(nameof(defaultOptionsWithMcs))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
+ [Test]
+ public void UserDefinedConversions([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
+ [Test]
+ public void Discards([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
@@ -427,26 +470,25 @@ namespace ICSharpCode.Decompiler.Tests
void Run([CallerMemberName] string testName = null, AssemblerOptions asmOptions = AssemblerOptions.None, CompilerOptions cscOptions = CompilerOptions.None, DecompilerSettings decompilerSettings = null)
{
- var ilFile = Path.Combine(TestCasePath, testName) + Tester.GetSuffix(cscOptions) + ".il";
var csFile = Path.Combine(TestCasePath, testName + ".cs");
+ var exeFile = Path.Combine(TestCasePath, testName) + Tester.GetSuffix(cscOptions) + ".exe";
+ if (cscOptions.HasFlag(CompilerOptions.Library)) {
+ exeFile = Path.ChangeExtension(exeFile, ".dll");
+ }
- if (!File.Exists(ilFile)) {
- // re-create .il file if necessary
- CompilerResults output = null;
- try {
- string outputFile = Path.ChangeExtension(ilFile,
- cscOptions.HasFlag(CompilerOptions.Library) ? ".dll" : ".exe");
- output = Tester.CompileCSharp(csFile, cscOptions, outputFile);
- Tester.Disassemble(output.PathToAssembly, ilFile, asmOptions);
- } finally {
- if (output != null)
- output.TempFiles.Delete();
- }
+ // 1. Compile
+ CompilerResults output = null;
+ try {
+ output = Tester.CompileCSharp(csFile, cscOptions, exeFile);
+ } finally {
+ if (output != null)
+ output.TempFiles.Delete();
}
- var executable = Tester.AssembleIL(ilFile, asmOptions);
- var decompiled = Tester.DecompileCSharp(executable, decompilerSettings ?? Tester.GetSettings(cscOptions));
+ // 2. Decompile
+ var decompiled = Tester.DecompileCSharp(exeFile, decompilerSettings ?? Tester.GetSettings(cscOptions));
+ // 3. Compile
CodeAssert.FilesAreEqual(csFile, decompiled, Tester.GetPreprocessorSymbols(cscOptions).ToArray());
}
}
diff --git a/ICSharpCode.Decompiler.Tests/RoundtripAssembly.cs b/ICSharpCode.Decompiler.Tests/RoundtripAssembly.cs
index 86e82c341..210a45d13 100644
--- a/ICSharpCode.Decompiler.Tests/RoundtripAssembly.cs
+++ b/ICSharpCode.Decompiler.Tests/RoundtripAssembly.cs
@@ -26,6 +26,7 @@ using System.Threading;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.Tests.Helpers;
+using Microsoft.Build.Locator;
using Microsoft.Win32;
using NUnit.Framework;
@@ -68,11 +69,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test]
public void ICSharpCode_Decompiler()
{
- try {
- RunWithTest("ICSharpCode.Decompiler", "ICSharpCode.Decompiler.dll", "ICSharpCode.Decompiler.Tests.exe");
- } catch (CompilationFailedException) {
- Assert.Ignore("C# 7 local functions not yet supported.");
- }
+ RunWithTest("ICSharpCode.Decompiler", "ICSharpCode.Decompiler.dll", "ICSharpCode.Decompiler.Tests.exe");
}
[Test]
@@ -105,11 +102,11 @@ namespace ICSharpCode.Decompiler.Tests
RunWithOutput("Random Tests\\TestCases", "TestCase-1.exe");
}
- void RunWithTest(string dir, string fileToRoundtrip, string fileToTest)
+ void RunWithTest(string dir, string fileToRoundtrip, string fileToTest, string keyFile = null)
{
- RunInternal(dir, fileToRoundtrip, outputDir => RunTest(outputDir, fileToTest));
+ RunInternal(dir, fileToRoundtrip, outputDir => RunTest(outputDir, fileToTest), keyFile);
}
-
+
void RunWithOutput(string dir, string fileToRoundtrip)
{
string inputDir = Path.Combine(TestDir, dir);
@@ -117,7 +114,7 @@ namespace ICSharpCode.Decompiler.Tests
outputDir => Tester.RunAndCompareOutput(fileToRoundtrip, Path.Combine(inputDir, fileToRoundtrip), Path.Combine(outputDir, fileToRoundtrip)));
}
- void RunInternal(string dir, string fileToRoundtrip, Action testAction)
+ void RunInternal(string dir, string fileToRoundtrip, Action testAction, string snkFilePath = null)
{
if (!Directory.Exists(TestDir)) {
Assert.Ignore($"Assembly-roundtrip test ignored: test directory '{TestDir}' needs to be checked out separately." + Environment.NewLine +
@@ -150,8 +147,14 @@ namespace ICSharpCode.Decompiler.Tests
resolver.RemoveSearchDirectory(".");
var decompiler = new TestProjectDecompiler(inputDir);
decompiler.AssemblyResolver = resolver;
+ // Let's limit the roundtrip tests to C# 7.3 for now; because 8.0 is still in preview
+ // and the generated project doesn't build as-is.
+ decompiler.Settings = new DecompilerSettings(LanguageVersion.CSharp7_3);
// use a fixed GUID so that we can diff the output between different ILSpy runs without spurious changes
decompiler.ProjectGuid = Guid.Parse("{127C83E4-4587-4CF9-ADCA-799875F3DFE6}");
+ if (snkFilePath != null) {
+ decompiler.StrongNameKeyFile = Path.Combine(inputDir, snkFilePath);
+ }
decompiler.DecompileProject(module, decompiledDir);
Console.WriteLine($"Decompiled {fileToRoundtrip} in {w.Elapsed.TotalSeconds:f2}");
projectFile = Path.Combine(decompiledDir, module.Name + ".csproj");
@@ -185,22 +188,16 @@ namespace ICSharpCode.Decompiler.Tests
File.Delete(file);
}
}
-
- static string FindVS2017()
- {
- using (var key = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) {
- using (var subkey = key.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\SxS\VS7")) {
- return subkey?.GetValue("15.0") as string;
- }
- }
- }
static string FindMSBuild()
{
- string vsPath = FindVS2017();
+ string vsPath = MSBuildLocator.QueryVisualStudioInstances(new VisualStudioInstanceQueryOptions { DiscoveryTypes = DiscoveryType.VisualStudioSetup })
+ .OrderByDescending(i => i.Version)
+ .FirstOrDefault()
+ ?.MSBuildPath;
if (vsPath == null)
- throw new InvalidOperationException("Could not find VS2017");
- return Path.Combine(vsPath, @"MSBuild\15.0\bin\MSBuild.exe");
+ throw new InvalidOperationException("Could not find MSBuild");
+ return Path.Combine(vsPath, "msbuild.exe");
}
static void Compile(string projectFile, string outputDir)
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LocalFunctions.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LocalFunctions.cs
deleted file mode 100644
index f05d95f27..000000000
--- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LocalFunctions.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LocalFunctions
-{
- class LocalFunctions
- {
- int field;
-
- public static void Main(string[] args)
- {
- StaticContextNoCapture(10);
- StaticContextSimpleCapture(10);
- StaticContextCaptureInForLoop(10);
- var inst = new LocalFunctions() { field = 10 };
- inst.ContextNoCapture();
- inst.ContextSimpleCapture();
- inst.ContextCaptureInForLoop();
- }
-
- public static void StaticContextNoCapture(int length)
- {
- for (int i = 0; i < length; i++) {
- LocalWrite("Hello " + i);
- }
-
- void LocalWrite(string s) => Console.WriteLine(s);
- }
-
- public static void StaticContextSimpleCapture(int length)
- {
- for (int i = 0; i < length; i++) {
- LocalWrite();
- }
-
- void LocalWrite() => Console.WriteLine("Hello " + length);
- }
-
- public static void StaticContextCaptureInForLoop(int length)
- {
- for (int i = 0; i < length; i++) {
- void LocalWrite() => Console.WriteLine("Hello " + i + "/" + length);
- LocalWrite();
- }
- }
-
- public void ContextNoCapture()
- {
- for (int i = 0; i < field; i++) {
- LocalWrite("Hello " + i);
- }
-
- void LocalWrite(string s) => Console.WriteLine(s);
- }
-
- public void ContextSimpleCapture()
- {
- for (int i = 0; i < field; i++) {
- LocalWrite();
- }
-
- void LocalWrite() => Console.WriteLine("Hello " + field);
- }
-
- public void ContextCaptureInForLoop()
- {
- for (int i = 0; i < field; i++) {
- void LocalWrite() => Console.WriteLine("Hello " + i + "/" + field);
- LocalWrite();
- }
- }
- }
-}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/RefLocalsAndReturns.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/RefLocalsAndReturns.cs
deleted file mode 100644
index 59f846290..000000000
--- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/RefLocalsAndReturns.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
-{
- class RefLocalsAndReturns
- {
- static int[] numbers = { 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023 };
- static string[] strings = { "Hello", "World" };
- static string NullString = "";
- static int DefaultInt = 0;
-
- public delegate ref TReturn RefFunc(T1 param1);
-
- public static TReturn Invoker(RefFunc action, T1 value)
- {
- return action(value);
- }
-
- public static ref int FindNumber(int target)
- {
- for (int ctr = 0; ctr < numbers.Length; ctr++) {
- if (numbers[ctr] >= target)
- return ref numbers[ctr];
- }
- return ref numbers[0];
- }
-
- public static ref int LastNumber()
- {
- return ref numbers[numbers.Length - 1];
- }
-
- public static ref int ElementAtOrDefault(int index)
- {
- return ref index < 0 || index >= numbers.Length ? ref DefaultInt : ref numbers[index];
- }
-
- public static ref int LastOrDefault()
- {
- return ref numbers.Length > 0 ? ref numbers[numbers.Length - 1] : ref DefaultInt;
- }
-
- public static void DoubleNumber(ref int num)
- {
- Console.WriteLine("old: " + num);
- num *= 2;
- Console.WriteLine("new: " + num);
- }
-
- public static ref string GetOrSetString(int index)
- {
- if (index < 0 || index >= strings.Length)
- return ref NullString;
- return ref strings[index];
- }
-
- public static void Main(string[] args)
- {
- DoubleNumber(ref FindNumber(32));
- Console.WriteLine(string.Join(", ", numbers));
- DoubleNumber(ref LastNumber());
- Console.WriteLine(string.Join(", ", numbers));
- Console.WriteLine(GetOrSetString(0));
- GetOrSetString(0) = "Goodbye";
- Console.WriteLine(string.Join(" ", strings));
- GetOrSetString(5) = "Here I mutated the null value!?";
- Console.WriteLine(GetOrSetString(-5));
-
- Console.WriteLine(Invoker(x => ref numbers[x], 0));
- Console.WriteLine(LastOrDefault());
- LastOrDefault() = 10000;
- Console.WriteLine(ElementAtOrDefault(-5));
- }
- }
-}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs
index 83b609b2f..437c37e54 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs
@@ -26,6 +26,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
{
InterestingConstants();
TruncatedComp();
+ StringConcat();
}
static void Print(T val)
@@ -92,5 +93,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
Print(val1 <= val2);
Print((int)val1 <= val2);
}
+
+ static void StringConcat()
+ {
+ // Some string.Concat()-cases that cannot be replaced using operator+
+ Print(string.Concat("String concat:"));
+ Print(string.Concat(1, 2));
+ Print(string.Concat(1, 2, "str"));
+ }
}
}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/ConstantBlobs.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/ConstantBlobs.cs
new file mode 100644
index 000000000..9279ace28
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/ConstantBlobs.cs
@@ -0,0 +1,9 @@
+namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty
+{
+ internal class ConstantBlobs
+ {
+ public static void Float_Int32(float f1 = 0f, float f2 = -1f, float f3 = int.MaxValue, float f4 = int.MinValue)
+ {
+ }
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/ConstantBlobs.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/ConstantBlobs.il
new file mode 100644
index 000000000..222bc0523
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/ConstantBlobs.il
@@ -0,0 +1,39 @@
+// 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 ConstantBlobs
+{
+ .ver 1:0:0:0
+}
+.module ConstantBlobs.exe
+// MVID: {B973FCD6-A9C4-48A9-8291-26DDC248E208}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00020003 // ILONLY 32BITPREFERRED
+// Image base: 0x000001C4B6C90000
+
+.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.ILPretty.ConstantBlobs
+ extends [mscorlib]System.Object
+{
+.method public hidebysig static void Float_Int32(
+ [opt] float32 f1,
+ [opt] float32 f2,
+ [opt] float32 f3,
+ [opt] float32 f4
+ ) cil managed
+{
+ .param [1] = int32(0)
+ .param [2] = int32(-1)
+ .param [3] = int32(2147483647)
+ .param [4] = int32(-2147483648)
+
+ // Code size 1 (0x1)
+ .maxstack 8
+ IL_0000: ret
+} // end of method Program::Float_Int32
+}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/DirectCallToExplicitInterfaceImpl.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/DirectCallToExplicitInterfaceImpl.cs
new file mode 100644
index 000000000..7e8fc4ee3
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/DirectCallToExplicitInterfaceImpl.cs
@@ -0,0 +1,14 @@
+using System;
+
+public sealed class TestClass : IDisposable
+{
+ void IDisposable.Dispose()
+ {
+ }
+
+ public void Test(TestClass other)
+ {
+ ((IDisposable)this).Dispose();
+ ((IDisposable)other).Dispose();
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/DirectCallToExplicitInterfaceImpl.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/DirectCallToExplicitInterfaceImpl.il
new file mode 100644
index 000000000..4a9a59309
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/DirectCallToExplicitInterfaceImpl.il
@@ -0,0 +1,36 @@
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly DirectCallToExplicitInterfaceImpl
+{
+ .ver 1:0:0:0
+}
+.module DirectCallToExplicitInterfaceImpl.exe
+
+.class public auto ansi sealed TestClass
+ extends [mscorlib]System.Object
+ implements [mscorlib]System.IDisposable
+{
+ // Methods
+
+ .method private final hidebysig newslot virtual
+ instance void System.IDisposable.Dispose () cil managed
+ {
+ .override method instance void [mscorlib]System.IDisposable::Dispose()
+ ret
+ }
+
+ .method public hidebysig void Test (class TestClass other) cil managed
+ {
+ ldarg.0
+ call instance void TestClass::System.IDisposable.Dispose()
+
+ ldarg.1
+ call instance void TestClass::System.IDisposable.Dispose()
+
+ ret
+ }
+
+} // end of class TestClass
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs
index fc7857261..f199ea1fd 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs
@@ -1,4 +1,3 @@
-
// C:\Users\Siegfried\Documents\Visual Studio 2017\Projects\ConsoleApp13\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
// ConsoleApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// Global type:
@@ -37,11 +36,6 @@ public static class Program
[CompilationMapping(SourceConstructFlags.Closure)]
internal sealed class disposable_00403 : IDisposable
{
- public disposable_00403()
- {
- ((object)this)._002Ector();
- }
-
private void System_002DIDisposable_002DDispose()
{
}
@@ -170,10 +164,10 @@ public static class Program
}
namespace _003CStartupCode_0024ConsoleApplication1_003E
{
- internal static class _0024Program
+ internal static class _0024AssemblyInfo
{
}
- internal static class _0024AssemblyInfo
+ internal static class _0024Program
{
}
}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs
index 39907241d..bfadda404 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs
@@ -37,11 +37,6 @@ public static class Program
[CompilationMapping(SourceConstructFlags.Closure)]
internal sealed class disposable_00403 : IDisposable
{
- public disposable_00403()
- {
- ((object)this)._002Ector();
- }
-
private void System_002DIDisposable_002DDispose()
{
}
@@ -172,10 +167,10 @@ public static class Program
}
namespace _003CStartupCode_0024ConsoleApplication1_003E
{
- internal static class _0024Program
+ internal static class _0024AssemblyInfo
{
}
- internal static class _0024AssemblyInfo
+ internal static class _0024Program
{
}
}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1047.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1047.cs
index f5d32e786..93f375a02 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1047.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1047.cs
@@ -6,12 +6,8 @@
private void ProblemMethod()
{
- IL_0000:
while (!dummy) {
}
- return;
- IL_0014:
- goto IL_0000;
}
}
}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1325.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1325.cs
index 5372e37be..daa5be110 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1325.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1325.cs
@@ -12,16 +12,7 @@ using System.Runtime.Versioning;
[assembly: TargetFramework(".NETCoreApp,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-namespace Microsoft.VisualBasic
-{
- [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class, Inherited = false)]
- [CompilerGenerated]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Embedded]
- internal sealed class Embedded : Attribute
- {
- }
-}
+
namespace Issue1325
{
[StandardModule]
@@ -40,19 +31,7 @@ namespace Issue1325
t.Unparameterized = str + "asdf";
}
}
-}
-namespace Microsoft.VisualBasic.CompilerServices
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- [AttributeUsage(AttributeTargets.Class, Inherited = false)]
- [CompilerGenerated]
- [Embedded]
- internal sealed class StandardModuleAttribute : Attribute
- {
- }
-}
-namespace Issue1325
-{
+
internal class Test
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
@@ -71,4 +50,24 @@ namespace Issue1325
set;
}
}
-}
\ No newline at end of file
+}
+namespace Microsoft.VisualBasic
+{
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class, Inherited = false)]
+ [CompilerGenerated]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Embedded]
+ internal sealed class Embedded : Attribute
+ {
+ }
+}
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
+ [CompilerGenerated]
+ [Embedded]
+ internal sealed class StandardModuleAttribute : Attribute
+ {
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs
index 00d6d297d..e2ee2eb3d 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs
@@ -12,7 +12,7 @@ namespace Issue1389
private static void UnusedResultOfIsinst()
{
- bool flag = GetObject() is TypeCode;
+ _ = (GetObject() is TypeCode);
}
private static bool BoolResultOfIsinst()
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1454.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1454.cs
new file mode 100644
index 000000000..a496e48d2
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1454.cs
@@ -0,0 +1,23 @@
+using System.Collections;
+
+namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty
+{
+ public class Issue1454
+ {
+ public static int GetCardinality(BitArray bitArray)
+ {
+ int[] array = new int[(bitArray.Count >> 5) + 1];
+ bitArray.CopyTo(array, 0);
+ int num = 0;
+ array[array.Length - 1] &= ~(-1 << bitArray.Count % 32);
+ for (int i = 0; i < array.Length; i++) {
+ int num2 = array[i];
+ num2 -= ((num2 >> 1) & 0x55555555);
+ num2 = (num2 & 0x33333333) + ((num2 >> 2) & 0x33333333);
+ num2 = ((num2 + (num2 >> 4)) & 0xF0F0F0F) * 16843009 >> 24;
+ num += num2;
+ }
+ return num;
+ }
+ }
+}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1454.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1454.il
new file mode 100644
index 000000000..b1dde8d6d
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1454.il
@@ -0,0 +1,125 @@
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+ .ver 4:0:0:0
+}
+.assembly Issue1454
+{
+ .hash algorithm 0x00008004
+ .ver 1:0:4059:39717
+}
+.module Issue1454.dll
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00000003 // ILONLY 32BITREQUIRED
+
+.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.ILPretty.Issue1454 extends [mscorlib]System.Object
+{
+
+.method public hidebysig static
+ int32 GetCardinality (
+ class [mscorlib]System.Collections.BitArray bitArray
+ ) cil managed
+{
+ .maxstack 5
+ .locals init (
+ [0] int32[],
+ [1] int32,
+ [2] int32,
+ [3] int32
+ )
+
+ IL_0000: ldarg.0
+ IL_0001: callvirt instance int32 [mscorlib]System.Collections.BitArray::get_Count()
+ IL_0006: ldc.i4.5
+ IL_0007: shr
+ IL_0008: ldc.i4.1
+ IL_0009: add
+ IL_000a: newarr [mscorlib]System.Int32
+ IL_000f: stloc.0
+ IL_0010: ldarg.0
+ IL_0011: ldloc.0
+ IL_0012: ldc.i4.0
+ IL_0013: callvirt instance void [mscorlib]System.Collections.BitArray::CopyTo(class [mscorlib]System.Array, int32)
+ IL_0018: ldc.i4.0
+ IL_0019: stloc.1
+ IL_001a: ldloc.0
+ IL_001b: ldloc.0
+ IL_001c: ldlen
+ IL_001d: conv.i4
+ IL_001e: ldc.i4.1
+ IL_001f: sub
+ IL_0020: ldelema [mscorlib]System.Int32
+ IL_0025: dup
+ IL_0026: ldind.i4
+ IL_0027: ldc.i4.m1
+ IL_0028: ldarg.0
+ IL_0029: callvirt instance int32 [mscorlib]System.Collections.BitArray::get_Count()
+ IL_002e: ldc.i4.s 32
+ IL_0030: rem
+ IL_0031: ldc.i4.s 31
+ IL_0033: and
+ IL_0034: shl
+ IL_0035: not
+ IL_0036: and
+ IL_0037: stind.i4
+ IL_0038: ldc.i4.0
+ IL_0039: stloc.2
+ IL_003a: br.s IL_007b
+ // loop start (head: IL_007b)
+ IL_003c: ldloc.0
+ IL_003d: ldloc.2
+ IL_003e: ldelem.i4
+ IL_003f: stloc.3
+ IL_0040: ldloc.3
+ IL_0041: ldloc.3
+ IL_0042: ldc.i4.1
+ IL_0043: shr
+ IL_0044: ldc.i4 1431655765
+ IL_0049: and
+ IL_004a: sub
+ IL_004b: stloc.3
+ IL_004c: ldloc.3
+ IL_004d: ldc.i4 858993459
+ IL_0052: and
+ IL_0053: ldloc.3
+ IL_0054: ldc.i4.2
+ IL_0055: shr
+ IL_0056: ldc.i4 858993459
+ IL_005b: and
+ IL_005c: add
+ IL_005d: stloc.3
+ IL_005e: ldloc.3
+ IL_005f: ldloc.3
+ IL_0060: ldc.i4.4
+ IL_0061: shr
+ IL_0062: add
+ IL_0063: ldc.i4 252645135
+ IL_0068: and
+ IL_0069: ldc.i4 16843009
+ IL_006e: mul
+ IL_006f: ldc.i4.s 24
+ IL_0071: shr
+ IL_0072: stloc.3
+ IL_0073: ldloc.1
+ IL_0074: ldloc.3
+ IL_0075: add
+ IL_0076: stloc.1
+ IL_0077: ldloc.2
+ IL_0078: ldc.i4.1
+ IL_0079: add
+ IL_007a: stloc.2
+
+ IL_007b: ldloc.2
+ IL_007c: ldloc.0
+ IL_007d: ldlen
+ IL_007e: conv.i4
+ IL_007f: blt.s IL_003c
+ // end loop
+
+ IL_0081: ldloc.1
+ IL_0082: ret
+}
+}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.cs
new file mode 100644
index 000000000..31ea4c132
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.cs
@@ -0,0 +1,15 @@
+namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty
+{
+ internal class BaseClass
+ {
+ public int importsClausePosition;
+ }
+
+ internal class Issue1681 : BaseClass
+ {
+ public void Test()
+ {
+ _ = importsClausePosition;
+ }
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.il
new file mode 100644
index 000000000..d3e5c2416
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.il
@@ -0,0 +1,42 @@
+// 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 ConsoleApp11
+{
+ .ver 1:0:0:0
+}
+.module ConsoleApp11.exe
+// MVID: {B973FCD6-A9C4-48A9-8291-26DDC248E208}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00020003 // ILONLY 32BITPREFERRED
+// Image base: 0x000001C4B6C90000
+
+.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.ILPretty.BaseClass
+ extends [mscorlib]System.Object
+{
+
+.field public int32 importsClausePosition
+
+}
+
+.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.ILPretty.Issue1681
+ extends ICSharpCode.Decompiler.Tests.TestCases.ILPretty.BaseClass
+{
+
+.method public hidebysig instance void Test() cil managed
+{
+ // Code size 18 (0x12)
+ .maxstack 8
+ ldarg.0
+ ldfld int32 class ICSharpCode.Decompiler.Tests.TestCases.ILPretty.BaseClass::importsClausePosition
+ pop
+ ret
+} // end of method Issue1681::Test
+
+}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue684.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue684.cs
new file mode 100644
index 000000000..5ec516778
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue684.cs
@@ -0,0 +1,39 @@
+using System;
+
+public static class Issue684
+{
+ static int Main(string[] A_0)
+ {
+ int[] array = new int[1000];
+ int num = int.Parse(Console.ReadLine());
+ // Point of this test was to ensure the stack slot here uses an appropriate type,
+ // (bool instead of int). Unfortunately our type fixup runs too late to affect variable names.
+ bool num2 = num >= 1000;
+ if (!num2) {
+ num2 = (num < 2);
+ }
+ if (num2) {
+ Console.WriteLine(-1);
+ } else {
+ int i = 2;
+ for (int num3 = 2; num3 <= num; num3 = i) {
+ Console.WriteLine(num3);
+ for (; i <= num; i += num3) {
+ int num4 = array[i] = 1;
+ }
+ i = num3;
+ while (true) {
+ bool num5 = i <= num;
+ if (num5) {
+ num5 = (array[i] != 0);
+ }
+ if (!num5) {
+ break;
+ }
+ i++;
+ }
+ }
+ }
+ return 0;
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue684.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue684.il
new file mode 100644
index 000000000..55417b20b
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue684.il
@@ -0,0 +1,133 @@
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly Issue684
+{
+ .ver 1:0:0:0
+}
+.module Issue684.exe
+
+.class public auto ansi abstract sealed Issue684
+ extends [mscorlib]System.Object
+{
+ // Methods
+
+ .method static privatescope
+ int32 Main$PST06000001 (
+ string[] ''
+ ) cil managed
+ {
+ // Method begins at RVA 0x2050
+ // Code size 196 (0xc4)
+ .maxstack 11
+ .entrypoint
+ .locals init (
+ [0] int32,
+ [1] int32,
+ [2] int32,
+ [3] int32[],
+ [4] int32
+ )
+
+ IL_0000: ldc.i4 1000
+ IL_0005: newarr [mscorlib]System.Int32
+ IL_000a: stloc.3
+ IL_000b: call string [mscorlib]System.Console::ReadLine()
+ IL_0010: call int32 [mscorlib]System.Int32::Parse(string)
+ IL_0015: stloc.2
+ IL_0016: ldloc.2
+ IL_0017: ldc.i4 1000
+ IL_001c: clt
+ IL_001e: ldc.i4.0
+ IL_001f: ceq
+ IL_0021: dup
+ IL_0022: brtrue IL_0030
+
+ IL_0027: pop
+ IL_0028: ldloc.2
+ IL_0029: ldc.i4 2
+ IL_002e: clt
+
+ IL_0030: brfalse IL_0045
+
+ IL_0035: ldc.i4 1
+ IL_003a: neg
+ IL_003b: call void [mscorlib]System.Console::WriteLine(int32)
+ IL_0040: br IL_00c2
+
+ IL_0045: ldc.i4 2
+ IL_004a: stloc.0
+ IL_004b: ldc.i4 2
+ IL_0050: stloc.1
+ // loop start (head: IL_0051)
+ IL_0051: ldloc.1
+ IL_0052: ldloc.2
+ IL_0053: cgt
+ IL_0055: ldc.i4.0
+ IL_0056: ceq
+ IL_0058: brfalse IL_00c2
+
+ IL_005d: ldloc.1
+ IL_005e: call void [mscorlib]System.Console::WriteLine(int32)
+ // loop start (head: IL_0063)
+ IL_0063: ldloc.0
+ IL_0064: ldloc.2
+ IL_0065: cgt
+ IL_0067: ldc.i4.0
+ IL_0068: ceq
+ IL_006a: brfalse IL_0088
+
+ IL_006f: ldc.i4 1
+ IL_0074: stloc.s 4
+ IL_0076: ldloc.3
+ IL_0077: ldloc.0
+ IL_0078: ldloc.s 4
+ IL_007a: stelem.any [mscorlib]System.Int32
+ IL_007f: ldloc.0
+ IL_0080: ldloc.1
+ IL_0081: add
+ IL_0082: stloc.0
+ IL_0083: br IL_0063
+ // end loop
+
+ IL_0088: ldloc.1
+ IL_0089: stloc.0
+ // loop start (head: IL_008a)
+ IL_008a: ldloc.0
+ IL_008b: ldloc.2
+ IL_008c: cgt
+ IL_008e: ldc.i4.0
+ IL_008f: ceq
+ IL_0091: dup
+ IL_0092: brfalse IL_00a9
+
+ IL_0097: pop
+ IL_0098: ldloc.3
+ IL_0099: ldloc.0
+ IL_009a: ldelem.any [mscorlib]System.Int32
+ IL_009f: ldc.i4 0
+ IL_00a4: ceq
+ IL_00a6: ldc.i4.0
+ IL_00a7: ceq
+
+ IL_00a9: brfalse IL_00bb
+
+ IL_00ae: ldloc.0
+ IL_00af: ldc.i4 1
+ IL_00b4: add
+ IL_00b5: stloc.0
+ IL_00b6: br IL_008a
+ // end loop
+
+ IL_00bb: ldloc.0
+ IL_00bc: stloc.1
+ IL_00bd: br IL_0051
+ // end loop
+
+ IL_00c2: ldc.i4.0
+ IL_00c3: ret
+ } // end of method Program::Main
+
+} // end of class Issue684
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.cs
new file mode 100644
index 000000000..f32b017d4
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.cs
@@ -0,0 +1,237 @@
+using System;
+using System.Reflection;
+
+[assembly: AssemblyFileVersion("4.0.0.0")]
+[assembly: AssemblyInformationalVersion("4.0.0.0")]
+[assembly: AssemblyTitle("System.Runtime.CompilerServices.Unsafe")]
+[assembly: AssemblyDescription("System.Runtime.CompilerServices.Unsafe")]
+[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
+[assembly: AssemblyMetadata("Serviceable", "True")]
+[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
+[assembly: AssemblyCompany("Microsoft Corporation")]
+[assembly: AssemblyProduct("Microsoft® .NET Framework")]
+[assembly: CLSCompliant(false)]
+
+namespace System.Runtime.CompilerServices
+{
+ public static class Unsafe
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static T Read(void* source)
+ {
+ return *(T*)source;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static T ReadUnaligned(void* source)
+ {
+ return *(T*)source;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static T ReadUnaligned(ref byte source)
+ {
+ return *(T*)(&source);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void Write(void* destination, T value)
+ {
+ *(T*)destination = value;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void WriteUnaligned(void* destination, T value)
+ {
+ *(T*)destination = value;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void WriteUnaligned(ref byte destination, T value)
+ {
+ *(T*)(&destination) = value;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void Copy(void* destination, ref T source)
+ {
+ *(T*)destination = source;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void Copy(ref T destination, void* source)
+ {
+ destination = *(T*)source;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void* AsPointer(ref T value)
+ {
+ return &value;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static int SizeOf()
+ {
+ return sizeof(T);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void CopyBlock(void* destination, void* source, uint byteCount)
+ {
+ // IL cpblk instruction
+ Unsafe.CopyBlock(destination, source, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void CopyBlock(ref byte destination, ref byte source, uint byteCount)
+ {
+ // IL cpblk instruction
+ Unsafe.CopyBlock(ref destination, ref source, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount)
+ {
+ // IL cpblk instruction
+ Unsafe.CopyBlockUnaligned(destination, source, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount)
+ {
+ // IL cpblk instruction
+ Unsafe.CopyBlockUnaligned(ref destination, ref source, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount)
+ {
+ // IL initblk instruction
+ Unsafe.InitBlock(startAddress, value, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void InitBlock(ref byte startAddress, byte value, uint byteCount)
+ {
+ // IL initblk instruction
+ Unsafe.InitBlock(ref startAddress, value, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount)
+ {
+ // IL initblk instruction
+ Unsafe.InitBlockUnaligned(startAddress, value, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount)
+ {
+ // IL initblk instruction
+ Unsafe.InitBlockUnaligned(ref startAddress, value, byteCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static T As(object o) where T : class
+ {
+ return (T)o;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static ref T AsRef(void* source)
+ {
+ return ref *(T*)source;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T AsRef(in T source)
+ {
+ return ref source;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static ref TTo As(ref TFrom source)
+ {
+ return ref *(TTo*)(&source);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T Unbox(object box) where T : struct
+ {
+ return ref (T)box;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T Add(ref T source, int elementOffset)
+ {
+ return ref Unsafe.Add(ref source, elementOffset);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void* Add(void* source, int elementOffset)
+ {
+ return (byte*)source + (long)elementOffset * (long)sizeof(T);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T Add(ref T source, IntPtr elementOffset)
+ {
+ return ref Unsafe.Add(ref source, elementOffset);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T AddByteOffset(ref T source, IntPtr byteOffset)
+ {
+ return ref Unsafe.AddByteOffset(ref source, byteOffset);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T Subtract(ref T source, int elementOffset)
+ {
+ return ref Unsafe.Subtract(ref source, elementOffset);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe static void* Subtract(void* source, int elementOffset)
+ {
+ return (byte*)source - (long)elementOffset * (long)sizeof(T);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T Subtract(ref T source, IntPtr elementOffset)
+ {
+ return ref Unsafe.Subtract(ref source, elementOffset);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T SubtractByteOffset(ref T source, IntPtr byteOffset)
+ {
+ return ref Unsafe.SubtractByteOffset(ref source, byteOffset);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static IntPtr ByteOffset(ref T origin, ref T target)
+ {
+ return Unsafe.ByteOffset(ref target, ref origin);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool AreSame(ref T left, ref T right)
+ {
+ return (ref left) == (ref right);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsAddressGreaterThan(ref T left, ref T right)
+ {
+ return (ref left) > (ref right);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsAddressLessThan(ref T left, ref T right)
+ {
+ return (ref left) < (ref right);
+ }
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.il
new file mode 100644
index 000000000..7ea5061df
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.il
@@ -0,0 +1,439 @@
+#define CORE_ASSEMBLY "System.Runtime"
+
+.assembly extern CORE_ASSEMBLY
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
+ .ver 4:0:0:0
+}
+
+.assembly System.Runtime.CompilerServices.Unsafe
+{
+ .custom instance void [CORE_ASSEMBLY]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .custom instance void [CORE_ASSEMBLY]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 [CORE_ASSEMBLY]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [CORE_ASSEMBLY]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
+
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 07 34 2E 30 2E 30 2E 30 00 00 ) // ...4.0.0.0..
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyInformationalVersionAttribute::.ctor(string) = ( 01 00 07 34 2E 30 2E 30 2E 30 00 00 ) // ...4.0.0.0..
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 26 53 79 73 74 65 6D 2E 52 75 6E 74 69 6D // ..&System.Runtim
+ 65 2E 43 6F 6D 70 69 6C 65 72 53 65 72 76 69 63 // e.CompilerServic
+ 65 73 2E 55 6E 73 61 66 65 00 00 ) // es.Unsafe..
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 26 53 79 73 74 65 6D 2E 52 75 6E 74 69 6D // ..&System.Runtim
+ 65 2E 43 6F 6D 70 69 6C 65 72 53 65 72 76 69 63 // e.CompilerServic
+ 65 73 2E 55 6E 73 61 66 65 00 00 ) // es.Unsafe..
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyMetadataAttribute::.ctor(string, string) = (
+ 01 00 15 2e 4e 45 54 46 72 61 6d 65 77 6f 72 6b
+ 41 73 73 65 6d 62 6c 79 00 00 00
+ ) // ".NETFrameworkAssembly", ""
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyMetadataAttribute::.ctor(string, string) = (
+ 01 00 0b 53 65 72 76 69 63 65 61 62 6c 65 04 54
+ 72 75 65 00 00
+ ) // "Serviceable", "True"
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 2F C2 A9 20 4D 69 63 72 6F 73 6F 66 74 20 // ../.. Microsoft
+ 43 6F 72 70 6F 72 61 74 69 6F 6E 2E 20 20 41 6C // Corporation. Al
+ 6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 // l rights reserve
+ 64 2E 00 00 ) // d...
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 15 4D 69 63 72 6F 73 6F 66 74 20 43 6F 72 // ...Microsoft Cor
+ 70 6F 72 61 74 69 6F 6E 00 00 ) // poration..
+ .custom instance void [CORE_ASSEMBLY]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 1A 4D 69 63 72 6F 73 6F 66 74 C2 AE 20 2E // ...Microsoft.. .
+ 4E 45 54 20 46 72 61 6D 65 77 6F 72 6B 00 00 ) // NET Framework..
+ .custom instance void [CORE_ASSEMBLY]System.CLSCompliantAttribute::.ctor(bool) = (
+ 01 00 00 00 00
+ ) // false
+ .hash algorithm 0x00008004
+ .ver 4:0:5:0
+}
+.module System.Runtime.CompilerServices.Unsafe.dll
+// MVID: {1E97D84A-565B-49C5-B60A-F31A1A4ACE13}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00000001 // ILONLY
+// Image base: 0x02ED0000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public abstract auto ansi sealed beforefieldinit System.Runtime.CompilerServices.Unsafe
+ extends [CORE_ASSEMBLY]System.Object
+{
+ .method public hidebysig static !!T Read(void* source) cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ ldobj !!T
+ ret
+ } // end of method Unsafe::Read
+
+ .method public hidebysig static !!T ReadUnaligned(void* source) cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ unaligned. 0x1
+ ldobj !!T
+ ret
+ } // end of method Unsafe::ReadUnaligned
+
+ .method public hidebysig static !!T ReadUnaligned(uint8& source) cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ unaligned. 0x1
+ ldobj !!T
+ ret
+ } // end of method Unsafe::ReadUnaligned
+
+ .method public hidebysig static void Write(void* destination,
+ !!T 'value') cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ stobj !!T
+ ret
+ } // end of method Unsafe::Write
+
+ .method public hidebysig static void WriteUnaligned(void* destination,
+ !!T 'value') cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ unaligned. 0x01
+ stobj !!T
+ ret
+ } // end of method Unsafe::WriteUnaligned
+
+ .method public hidebysig static void WriteUnaligned(uint8& destination,
+ !!T 'value') cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ unaligned. 0x01
+ stobj !!T
+ ret
+ } // end of method Unsafe::WriteUnaligned
+
+ .method public hidebysig static void Copy(void* destination,
+ !!T& source) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ ldobj !!T
+ stobj !!T
+ ret
+ } // end of method Unsafe::Copy
+
+ .method public hidebysig static void Copy(!!T& destination,
+ void* source) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ ldobj !!T
+ stobj !!T
+ ret
+ } // end of method Unsafe::Copy
+
+ .method public hidebysig static void* AsPointer(!!T& 'value') cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ conv.u
+ ret
+ } // end of method Unsafe::AsPointer
+
+ .method public hidebysig static int32 SizeOf() cil managed aggressiveinlining
+ {
+ .maxstack 1
+ sizeof !!T
+ ret
+ } // end of method Unsafe::SizeOf
+
+ .method public hidebysig static void CopyBlock(void* destination, void* source, uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ cpblk
+ ret
+ } // end of method Unsafe::CopyBlock
+
+ .method public hidebysig static void CopyBlock(uint8& destination, uint8& source, uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ cpblk
+ ret
+ } // end of method Unsafe::CopyBlock
+
+ .method public hidebysig static void CopyBlockUnaligned(void* destination, void* source, uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ unaligned. 0x1
+ cpblk
+ ret
+ } // end of method Unsafe::CopyBlockUnaligned
+
+ .method public hidebysig static void CopyBlockUnaligned(uint8& destination, uint8& source, uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ unaligned. 0x1
+ cpblk
+ ret
+ } // end of method Unsafe::CopyBlockUnaligned
+
+ .method public hidebysig static void InitBlock(void* startAddress, uint8 'value', uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ initblk
+ ret
+ } // end of method Unsafe::InitBlock
+
+ .method public hidebysig static void InitBlock(uint8& startAddress, uint8 'value', uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ initblk
+ ret
+ } // end of method Unsafe::InitBlock
+
+ .method public hidebysig static void InitBlockUnaligned(void* startAddress, uint8 'value', uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ unaligned. 0x1
+ initblk
+ ret
+ } // end of method Unsafe::InitBlockUnaligned
+
+ .method public hidebysig static void InitBlockUnaligned(uint8& startAddress, uint8 'value', uint32 byteCount) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ ldarg.2
+ unaligned. 0x1
+ initblk
+ ret
+ } // end of method Unsafe::InitBlockUnaligned
+
+ .method public hidebysig static !!T As(object o) cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ ret
+ } // end of method Unsafe::As
+
+ .method public hidebysig static !!T& AsRef(void* source) cil managed aggressiveinlining
+ {
+// For .NET Core the roundtrip via a local is no longer needed see:
+// https://github.com/dotnet/coreclr/issues/13341
+// and
+// https://github.com/dotnet/coreclr/pull/11218
+#ifdef netcoreapp
+ .maxstack 1
+ ldarg.0
+ ret
+#else
+ .locals (int32&)
+ .maxstack 1
+ ldarg.0
+ // Roundtrip via a local to avoid type mismatch on return that the JIT inliner chokes on.
+ stloc.0
+ ldloc.0
+ ret
+#endif
+ } // end of method Unsafe::AsRef
+
+ .method public hidebysig static !!T& AsRef(!!T& source) cil managed aggressiveinlining
+ {
+ .param [1]
+#ifdef netcoreapp
+ .custom instance void [CORE_ASSEMBLY]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
+#else
+ .custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
+#endif
+ .maxstack 1
+ ldarg.0
+ ret
+ } // end of method Unsafe::AsRef
+
+ .method public hidebysig static !!TTo& As(!!TFrom& source) cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ ret
+ } // end of method Unsafe::As
+
+ .method public hidebysig static !!T& Unbox (object 'box') cil managed aggressiveinlining
+ {
+ .maxstack 1
+ ldarg.0
+ unbox !!T
+ ret
+ } // end of method Unsafe::Unbox
+
+ .method public hidebysig static !!T& Add(!!T& source, int32 elementOffset) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ sizeof !!T
+ conv.i
+ mul
+ add
+ ret
+ } // end of method Unsafe::Add
+
+ .method public hidebysig static void* Add(void* source, int32 elementOffset) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ sizeof !!T
+ conv.i
+ mul
+ add
+ ret
+ } // end of method Unsafe::Add
+
+ .method public hidebysig static !!T& Add(!!T& source, native int elementOffset) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ sizeof !!T
+ mul
+ add
+ ret
+ } // end of method Unsafe::Add
+
+ .method public hidebysig static !!T& AddByteOffset(!!T& source, native int byteOffset) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ } // end of method Unsafe::AddByteOffset
+
+ .method public hidebysig static !!T& Subtract(!!T& source, int32 elementOffset) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ sizeof !!T
+ conv.i
+ mul
+ sub
+ ret
+ } // end of method Unsafe::Subtract
+
+ .method public hidebysig static void* Subtract(void* source, int32 elementOffset) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ sizeof !!T
+ conv.i
+ mul
+ sub
+ ret
+ } // end of method Unsafe::Subtract
+
+ .method public hidebysig static !!T& Subtract(!!T& source, native int elementOffset) cil managed aggressiveinlining
+ {
+ .maxstack 3
+ ldarg.0
+ ldarg.1
+ sizeof !!T
+ mul
+ sub
+ ret
+ } // end of method Unsafe::Subtract
+
+ .method public hidebysig static !!T& SubtractByteOffset(!!T& source, native int byteOffset) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ } // end of method Unsafe::SubtractByteOffset
+
+ .method public hidebysig static native int ByteOffset(!!T& origin, !!T& target) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.1
+ ldarg.0
+ sub
+ ret
+ } // end of method Unsafe::ByteOffset
+
+ .method public hidebysig static bool AreSame(!!T& left, !!T& right) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ ceq
+ ret
+ } // end of method Unsafe::AreSame
+
+ .method public hidebysig static bool IsAddressGreaterThan(!!T& left, !!T& right) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ cgt.un
+ ret
+ } // end of method Unsafe::IsAddressGreaterThan
+
+ .method public hidebysig static bool IsAddressLessThan(!!T& left, !!T& right) cil managed aggressiveinlining
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ clt.un
+ ret
+ } // end of method Unsafe::IsAddressLessThan
+
+} // end of class System.Runtime.CompilerServices.Unsafe
+
+#ifdef netcoreapp
+#else
+.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.IsReadOnlyAttribute
+ extends [CORE_ASSEMBLY]System.Attribute
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor () cil managed
+ {
+ .maxstack 1
+ ldarg.0
+ call instance void [CORE_ASSEMBLY]System.Attribute::.ctor()
+ ret
+ } // end of method IsReadOnlyAttribute::.ctor
+
+} // end of class System.Runtime.CompilerServices.IsReadOnlyAttribute
+#endif
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.il
deleted file mode 100644
index aa70d27c2..000000000
--- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.il
+++ /dev/null
@@ -1,849 +0,0 @@
-
-
-
-
-// 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 AnonymousTypes
-{
- .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.
- .permissionset reqmin
- = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
- .hash algorithm 0x00008004
- .ver 0:0:0:0
-}
-.module AnonymousTypes.dll
-.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
-
-
-// =============== CLASS MEMBERS DECLARATION ===================
-
-.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.AnonymousTypes
- extends [mscorlib]System.Object
-{
- .method private hidebysig instance void
- SimpleTypes() cil managed
- {
- // Code size 62 (0x3e)
- .maxstack 2
- .locals init (class '<>f__AnonymousType0' V_0,
- class '<>f__AnonymousType1`1' V_1,
- class '<>f__AnonymousType2`2' V_2)
- IL_0000: nop
- IL_0001: newobj instance void '<>f__AnonymousType0'::.ctor()
- IL_0006: stloc.0
- IL_0007: ldc.i4.5
- IL_0008: newobj instance void class '<>f__AnonymousType1`1'::.ctor(!0)
- IL_000d: stloc.1
- IL_000e: ldc.i4.5
- IL_000f: ldc.i4.s 10
- IL_0011: newobj instance void class '<>f__AnonymousType2`2'::.ctor(!0,
- !1)
- IL_0016: stloc.2
- IL_0017: ldloc.0
- IL_0018: call void [mscorlib]System.Console::WriteLine(object)
- IL_001d: nop
- IL_001e: ldloc.1
- IL_001f: callvirt instance !0 class '<>f__AnonymousType1`1'::get_X()
- IL_0024: call void [mscorlib]System.Console::WriteLine(int32)
- IL_0029: nop
- IL_002a: ldloc.2
- IL_002b: callvirt instance !1 class '<>f__AnonymousType2`2'::get_Y()
- IL_0030: ldloc.2
- IL_0031: callvirt instance !0 class '<>f__AnonymousType2`2'::get_X()
- IL_0036: add
- IL_0037: call void [mscorlib]System.Console::WriteLine(int32)
- IL_003c: nop
- IL_003d: ret
- } // end of method AnonymousTypes::SimpleTypes
-
- .method private hidebysig instance void
- SimpleArray() cil managed
- {
- // Code size 62 (0x3e)
- .maxstack 5
- .locals init (class '<>f__AnonymousType3`3'[] V_0,
- class '<>f__AnonymousType3`3'[] V_1)
- IL_0000: nop
- IL_0001: ldc.i4.2
- IL_0002: newarr class '<>f__AnonymousType3`3'
- IL_0007: stloc.1
- IL_0008: ldloc.1
- IL_0009: ldc.i4.0
- IL_000a: ldc.i4.5
- IL_000b: ldc.i4.2
- IL_000c: ldc.i4.m1
- IL_000d: newobj instance void class '<>f__AnonymousType3`3'::.ctor(!0,
- !1,
- !2)
- IL_0012: stelem.ref
- IL_0013: ldloc.1
- IL_0014: ldc.i4.1
- IL_0015: ldc.i4.3
- IL_0016: ldc.i4.6
- IL_0017: ldc.i4.s -6
- IL_0019: newobj instance void class '<>f__AnonymousType3`3'::.ctor(!0,
- !1,
- !2)
- IL_001e: stelem.ref
- IL_001f: ldloc.1
- IL_0020: stloc.0
- IL_0021: ldloc.0
- IL_0022: ldc.i4.0
- IL_0023: ldelem.ref
- IL_0024: callvirt instance !0 class '<>f__AnonymousType3`3'::get_X()
- IL_0029: call void [mscorlib]System.Console::WriteLine(int32)
- IL_002e: nop
- IL_002f: ldloc.0
- IL_0030: ldc.i4.1
- IL_0031: ldelem.ref
- IL_0032: callvirt instance !0 class '<>f__AnonymousType3`3'::get_X()
- IL_0037: call void [mscorlib]System.Console::WriteLine(int32)
- IL_003c: nop
- IL_003d: ret
- } // end of method AnonymousTypes::SimpleArray
-
- .method private hidebysig instance void
- JaggedArray() cil managed
- {
- // Code size 88 (0x58)
- .maxstack 5
- .locals init (class '<>f__AnonymousType3`3'[] V_0,
- class '<>f__AnonymousType3`3'[][] V_1,
- class '<>f__AnonymousType3`3'[] V_2,
- class '<>f__AnonymousType3`3'[][] V_3)
- IL_0000: nop
- IL_0001: ldc.i4.2
- IL_0002: newarr class '<>f__AnonymousType3`3'
- IL_0007: stloc.2
- IL_0008: ldloc.2
- IL_0009: ldc.i4.0
- IL_000a: ldc.i4.5
- IL_000b: ldc.i4.2
- IL_000c: ldc.i4.m1
- IL_000d: newobj instance void class '<>f__AnonymousType3`3'::.ctor(!0,
- !1,
- !2)
- IL_0012: stelem.ref
- IL_0013: ldloc.2
- IL_0014: ldc.i4.1
- IL_0015: ldc.i4.3
- IL_0016: ldc.i4.6
- IL_0017: ldc.i4.s -6
- IL_0019: newobj instance void class '<>f__AnonymousType3`3'::.ctor(!0,
- !1,
- !2)
- IL_001e: stelem.ref
- IL_001f: ldloc.2
- IL_0020: stloc.0
- IL_0021: ldc.i4.2
- IL_0022: newarr class '<>f__AnonymousType3`3'[]
- IL_0027: stloc.3
- IL_0028: ldloc.3
- IL_0029: ldc.i4.0
- IL_002a: ldloc.0
- IL_002b: stelem.ref
- IL_002c: ldloc.3
- IL_002d: ldc.i4.1
- IL_002e: ldloc.0
- IL_002f: stelem.ref
- IL_0030: ldloc.3
- IL_0031: stloc.1
- IL_0032: ldloc.0
- IL_0033: ldc.i4.0
- IL_0034: ldelem.ref
- IL_0035: callvirt instance !0 class '<>f__AnonymousType3`3'::get_X()
- IL_003a: call void [mscorlib]System.Console::WriteLine(int32)
- IL_003f: nop
- IL_0040: ldloc.0
- IL_0041: ldc.i4.1
- IL_0042: ldelem.ref
- IL_0043: callvirt instance !0 class '<>f__AnonymousType3`3'::get_X()
- IL_0048: call void [mscorlib]System.Console::WriteLine(int32)
- IL_004d: nop
- IL_004e: ldloc.1
- IL_004f: ldlen
- IL_0050: conv.i4
- IL_0051: call void [mscorlib]System.Console::WriteLine(int32)
- IL_0056: nop
- IL_0057: ret
- } // end of method AnonymousTypes::JaggedArray
-
- .method private hidebysig static void InlineVarDecl([out] !!T& v,
- !!T 'init') cil managed
- {
- // Code size 9 (0x9)
- .maxstack 8
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldarg.1
- IL_0003: stobj !!T
- IL_0008: ret
- } // end of method AnonymousTypes::InlineVarDecl
-
- .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 AnonymousTypes::.ctor
-
-} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AnonymousTypes
-
-.class private auto ansi sealed beforefieldinit '<>f__AnonymousType0'
- extends [mscorlib]System.Object
-{
- .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
- .method public hidebysig specialname rtspecialname
- instance void .ctor() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // 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 '<>f__AnonymousType0'::.ctor
-
- .method public hidebysig virtual instance string
- ToString() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 29 (0x1d)
- .maxstack 2
- .locals init (class [mscorlib]System.Text.StringBuilder V_0,
- string V_1)
- IL_0000: newobj instance void [mscorlib]System.Text.StringBuilder::.ctor()
- IL_0005: stloc.0
- IL_0006: ldloc.0
- IL_0007: ldstr "{ }"
- IL_000c: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_0011: pop
- IL_0012: ldloc.0
- IL_0013: callvirt instance string [mscorlib]System.Object::ToString()
- IL_0018: stloc.1
- IL_0019: br.s IL_001b
-
- IL_001b: ldloc.1
- IL_001c: ret
- } // end of method '<>f__AnonymousType0'::ToString
-
- .method public hidebysig virtual instance bool
- Equals(object 'value') cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 19 (0x13)
- .maxstack 2
- .locals init (class '<>f__AnonymousType0' V_0,
- bool V_1)
- IL_0000: ldarg.1
- IL_0001: isinst '<>f__AnonymousType0'
- IL_0006: stloc.0
- IL_0007: ldloc.0
- IL_0008: ldnull
- IL_0009: ceq
- IL_000b: ldc.i4.0
- IL_000c: ceq
- IL_000e: stloc.1
- IL_000f: br.s IL_0011
-
- IL_0011: ldloc.1
- IL_0012: ret
- } // end of method '<>f__AnonymousType0'::Equals
-
- .method public hidebysig virtual instance int32
- GetHashCode() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 8 (0x8)
- .maxstack 1
- .locals init (int32 V_0,
- int32 V_1)
- IL_0000: ldc.i4.0
- IL_0001: stloc.0
- IL_0002: ldloc.0
- IL_0003: stloc.1
- IL_0004: br.s IL_0006
-
- IL_0006: ldloc.1
- IL_0007: ret
- } // end of method '<>f__AnonymousType0'::GetHashCode
-
-} // end of class '<>f__AnonymousType0'
-
-.class private auto ansi sealed beforefieldinit '<>f__AnonymousType1`1'<'j__TPar'>
- extends [mscorlib]System.Object
-{
- .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
- .field private initonly !'j__TPar' 'i__Field'
- .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
- .method public hidebysig specialname rtspecialname
- instance void .ctor(!'j__TPar' X) cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 14 (0xe)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: call instance void [mscorlib]System.Object::.ctor()
- IL_0006: ldarg.0
- IL_0007: ldarg.1
- IL_0008: stfld !0 class '<>f__AnonymousType1`1'j__TPar'>::'i__Field'
- IL_000d: ret
- } // end of method '<>f__AnonymousType1`1'::.ctor
-
- .method public hidebysig specialname instance !'j__TPar'
- get_X() cil managed
- {
- // Code size 11 (0xb)
- .maxstack 1
- .locals init (!'j__TPar' V_0)
- IL_0000: ldarg.0
- IL_0001: ldfld !0 class '<>f__AnonymousType1`1'j__TPar'>::'i__Field'
- IL_0006: stloc.0
- IL_0007: br.s IL_0009
-
- IL_0009: ldloc.0
- IL_000a: ret
- } // end of method '<>f__AnonymousType1`1'::get_X
-
- .method public hidebysig virtual instance string
- ToString() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 59 (0x3b)
- .maxstack 2
- .locals init (class [mscorlib]System.Text.StringBuilder V_0,
- string V_1)
- IL_0000: newobj instance void [mscorlib]System.Text.StringBuilder::.ctor()
- IL_0005: stloc.0
- IL_0006: ldloc.0
- IL_0007: ldstr "{ X = "
- IL_000c: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_0011: pop
- IL_0012: ldloc.0
- IL_0013: ldarg.0
- IL_0014: ldfld !0 class '<>f__AnonymousType1`1'j__TPar'>::'i__Field'
- IL_0019: box !'j__TPar'
- IL_001e: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(object)
- IL_0023: pop
- IL_0024: ldloc.0
- IL_0025: ldstr " }"
- IL_002a: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_002f: pop
- IL_0030: ldloc.0
- IL_0031: callvirt instance string [mscorlib]System.Object::ToString()
- IL_0036: stloc.1
- IL_0037: br.s IL_0039
-
- IL_0039: ldloc.1
- IL_003a: ret
- } // end of method '<>f__AnonymousType1`1'::ToString
-
- .method public hidebysig virtual instance bool
- Equals(object 'value') cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 41 (0x29)
- .maxstack 3
- .locals init (class '<>f__AnonymousType1`1'j__TPar'> V_0,
- bool V_1)
- IL_0000: ldarg.1
- IL_0001: isinst class '<>f__AnonymousType1`1'j__TPar'>
- IL_0006: stloc.0
- IL_0007: ldloc.0
- IL_0008: brfalse.s IL_0022
-
- IL_000a: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_000f: ldarg.0
- IL_0010: ldfld !0 class '<>f__AnonymousType1`1'j__TPar'>::'i__Field'
- IL_0015: ldloc.0
- IL_0016: ldfld !0 class '<>f__AnonymousType1`1'j__TPar'>::'i__Field'
- IL_001b: callvirt instance bool class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::Equals(!0,
- !0)
- IL_0020: br.s IL_0023
-
- IL_0022: ldc.i4.0
- IL_0023: nop
- IL_0024: stloc.1
- IL_0025: br.s IL_0027
-
- IL_0027: ldloc.1
- IL_0028: ret
- } // end of method '<>f__AnonymousType1`1'::Equals
-
- .method public hidebysig virtual instance int32
- GetHashCode() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 37 (0x25)
- .maxstack 3
- .locals init (int32 V_0,
- int32 V_1)
- IL_0000: ldc.i4 0x12721cd8
- IL_0005: stloc.0
- IL_0006: ldc.i4 0xa5555529
- IL_000b: ldloc.0
- IL_000c: mul
- IL_000d: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_0012: ldarg.0
- IL_0013: ldfld !0 class '<>f__AnonymousType1`1'j__TPar'>::'i__Field'
- IL_0018: callvirt instance int32 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::GetHashCode(!0)
- IL_001d: add
- IL_001e: stloc.0
- IL_001f: ldloc.0
- IL_0020: stloc.1
- IL_0021: br.s IL_0023
-
- IL_0023: ldloc.1
- IL_0024: ret
- } // end of method '<>f__AnonymousType1`1'::GetHashCode
-
- .property instance !'j__TPar' X()
- {
- .get instance !'j__TPar' '<>f__AnonymousType1`1'::get_X()
- } // end of property '<>f__AnonymousType1`1'::X
-} // end of class '<>f__AnonymousType1`1'
-
-.class private auto ansi sealed beforefieldinit '<>f__AnonymousType2`2'<'j__TPar','j__TPar'>
- extends [mscorlib]System.Object
-{
- .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
- .field private initonly !'j__TPar' 'i__Field'
- .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
- .field private initonly !'j__TPar' 'i__Field'
- .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
- .method public hidebysig specialname rtspecialname
- instance void .ctor(!'j__TPar' X,
- !'j__TPar' Y) cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 21 (0x15)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: call instance void [mscorlib]System.Object::.ctor()
- IL_0006: ldarg.0
- IL_0007: ldarg.1
- IL_0008: stfld !0 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_000d: ldarg.0
- IL_000e: ldarg.2
- IL_000f: stfld !1 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0014: ret
- } // end of method '<>f__AnonymousType2`2'::.ctor
-
- .method public hidebysig specialname instance !'j__TPar'
- get_X() cil managed
- {
- // Code size 11 (0xb)
- .maxstack 1
- .locals init (!'j__TPar' V_0)
- IL_0000: ldarg.0
- IL_0001: ldfld !0 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0006: stloc.0
- IL_0007: br.s IL_0009
-
- IL_0009: ldloc.0
- IL_000a: ret
- } // end of method '<>f__AnonymousType2`2'::get_X
-
- .method public hidebysig specialname instance !'j__TPar'
- get_Y() cil managed
- {
- // Code size 11 (0xb)
- .maxstack 1
- .locals init (!'j__TPar' V_0)
- IL_0000: ldarg.0
- IL_0001: ldfld !1 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0006: stloc.0
- IL_0007: br.s IL_0009
-
- IL_0009: ldloc.0
- IL_000a: ret
- } // end of method '<>f__AnonymousType2`2'::get_Y
-
- .method public hidebysig virtual instance string
- ToString() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 89 (0x59)
- .maxstack 2
- .locals init (class [mscorlib]System.Text.StringBuilder V_0,
- string V_1)
- IL_0000: newobj instance void [mscorlib]System.Text.StringBuilder::.ctor()
- IL_0005: stloc.0
- IL_0006: ldloc.0
- IL_0007: ldstr "{ X = "
- IL_000c: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_0011: pop
- IL_0012: ldloc.0
- IL_0013: ldarg.0
- IL_0014: ldfld !0 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0019: box !'j__TPar'
- IL_001e: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(object)
- IL_0023: pop
- IL_0024: ldloc.0
- IL_0025: ldstr ", Y = "
- IL_002a: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_002f: pop
- IL_0030: ldloc.0
- IL_0031: ldarg.0
- IL_0032: ldfld !1 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0037: box !'j__TPar'
- IL_003c: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(object)
- IL_0041: pop
- IL_0042: ldloc.0
- IL_0043: ldstr " }"
- IL_0048: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_004d: pop
- IL_004e: ldloc.0
- IL_004f: callvirt instance string [mscorlib]System.Object::ToString()
- IL_0054: stloc.1
- IL_0055: br.s IL_0057
-
- IL_0057: ldloc.1
- IL_0058: ret
- } // end of method '<>f__AnonymousType2`2'::ToString
-
- .method public hidebysig virtual instance bool
- Equals(object 'value') cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 65 (0x41)
- .maxstack 3
- .locals init (class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'> V_0,
- bool V_1)
- IL_0000: ldarg.1
- IL_0001: isinst class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>
- IL_0006: stloc.0
- IL_0007: ldloc.0
- IL_0008: brfalse.s IL_003a
-
- IL_000a: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_000f: ldarg.0
- IL_0010: ldfld !0 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0015: ldloc.0
- IL_0016: ldfld !0 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_001b: callvirt instance bool class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::Equals(!0,
- !0)
- IL_0020: brfalse.s IL_003a
-
- IL_0022: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_0027: ldarg.0
- IL_0028: ldfld !1 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_002d: ldloc.0
- IL_002e: ldfld !1 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0033: callvirt instance bool class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::Equals(!0,
- !0)
- IL_0038: br.s IL_003b
-
- IL_003a: ldc.i4.0
- IL_003b: nop
- IL_003c: stloc.1
- IL_003d: br.s IL_003f
-
- IL_003f: ldloc.1
- IL_0040: ret
- } // end of method '<>f__AnonymousType2`2'::Equals
-
- .method public hidebysig virtual instance int32
- GetHashCode() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 62 (0x3e)
- .maxstack 3
- .locals init (int32 V_0,
- int32 V_1)
- IL_0000: ldc.i4 0xc18f39dd
- IL_0005: stloc.0
- IL_0006: ldc.i4 0xa5555529
- IL_000b: ldloc.0
- IL_000c: mul
- IL_000d: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_0012: ldarg.0
- IL_0013: ldfld !0 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0018: callvirt instance int32 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::GetHashCode(!0)
- IL_001d: add
- IL_001e: stloc.0
- IL_001f: ldc.i4 0xa5555529
- IL_0024: ldloc.0
- IL_0025: mul
- IL_0026: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_002b: ldarg.0
- IL_002c: ldfld !1 class '<>f__AnonymousType2`2'j__TPar',!'j__TPar'>::'i__Field'
- IL_0031: callvirt instance int32 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::GetHashCode(!0)
- IL_0036: add
- IL_0037: stloc.0
- IL_0038: ldloc.0
- IL_0039: stloc.1
- IL_003a: br.s IL_003c
-
- IL_003c: ldloc.1
- IL_003d: ret
- } // end of method '<>f__AnonymousType2`2'::GetHashCode
-
- .property instance !'j__TPar' X()
- {
- .get instance !'j__TPar' '<>f__AnonymousType2`2'::get_X()
- } // end of property '<>f__AnonymousType2`2'::X
- .property instance !'j__TPar' Y()
- {
- .get instance !'j__TPar' '<>f__AnonymousType2`2'::get_Y()
- } // end of property '<>f__AnonymousType2`2'::Y
-} // end of class '<>f__AnonymousType2`2'
-
-.class private auto ansi sealed beforefieldinit '<>f__AnonymousType3`3'<'j__TPar','j__TPar','j__TPar'>
- extends [mscorlib]System.Object
-{
- .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
- .field private initonly !'j__TPar' 'i__Field'
- .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
- .field private initonly !'j__TPar' 'i__Field'
- .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
- .field private initonly !'j__TPar' 'i__Field'
- .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
- .method public hidebysig specialname rtspecialname
- instance void .ctor(!'j__TPar' X,
- !'j__TPar' Y,
- !'j__TPar' Z) cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 28 (0x1c)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: call instance void [mscorlib]System.Object::.ctor()
- IL_0006: ldarg.0
- IL_0007: ldarg.1
- IL_0008: stfld !0 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_000d: ldarg.0
- IL_000e: ldarg.2
- IL_000f: stfld !1 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0014: ldarg.0
- IL_0015: ldarg.3
- IL_0016: stfld !2 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_001b: ret
- } // end of method '<>f__AnonymousType3`3'::.ctor
-
- .method public hidebysig specialname instance !'j__TPar'
- get_X() cil managed
- {
- // Code size 11 (0xb)
- .maxstack 1
- .locals init (!'j__TPar' V_0)
- IL_0000: ldarg.0
- IL_0001: ldfld !0 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0006: stloc.0
- IL_0007: br.s IL_0009
-
- IL_0009: ldloc.0
- IL_000a: ret
- } // end of method '<>f__AnonymousType3`3'::get_X
-
- .method public hidebysig specialname instance !'j__TPar'
- get_Y() cil managed
- {
- // Code size 11 (0xb)
- .maxstack 1
- .locals init (!'j__TPar' V_0)
- IL_0000: ldarg.0
- IL_0001: ldfld !1 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0006: stloc.0
- IL_0007: br.s IL_0009
-
- IL_0009: ldloc.0
- IL_000a: ret
- } // end of method '<>f__AnonymousType3`3'::get_Y
-
- .method public hidebysig specialname instance !'j__TPar'
- get_Z() cil managed
- {
- // Code size 11 (0xb)
- .maxstack 1
- .locals init (!'j__TPar' V_0)
- IL_0000: ldarg.0
- IL_0001: ldfld !2 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0006: stloc.0
- IL_0007: br.s IL_0009
-
- IL_0009: ldloc.0
- IL_000a: ret
- } // end of method '<>f__AnonymousType3`3'::get_Z
-
- .method public hidebysig virtual instance string
- ToString() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 119 (0x77)
- .maxstack 2
- .locals init (class [mscorlib]System.Text.StringBuilder V_0,
- string V_1)
- IL_0000: newobj instance void [mscorlib]System.Text.StringBuilder::.ctor()
- IL_0005: stloc.0
- IL_0006: ldloc.0
- IL_0007: ldstr "{ X = "
- IL_000c: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_0011: pop
- IL_0012: ldloc.0
- IL_0013: ldarg.0
- IL_0014: ldfld !0 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0019: box !'j__TPar'
- IL_001e: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(object)
- IL_0023: pop
- IL_0024: ldloc.0
- IL_0025: ldstr ", Y = "
- IL_002a: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_002f: pop
- IL_0030: ldloc.0
- IL_0031: ldarg.0
- IL_0032: ldfld !1 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0037: box !'j__TPar'
- IL_003c: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(object)
- IL_0041: pop
- IL_0042: ldloc.0
- IL_0043: ldstr ", Z = "
- IL_0048: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_004d: pop
- IL_004e: ldloc.0
- IL_004f: ldarg.0
- IL_0050: ldfld !2 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0055: box !'j__TPar'
- IL_005a: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(object)
- IL_005f: pop
- IL_0060: ldloc.0
- IL_0061: ldstr " }"
- IL_0066: callvirt instance class [mscorlib]System.Text.StringBuilder [mscorlib]System.Text.StringBuilder::Append(string)
- IL_006b: pop
- IL_006c: ldloc.0
- IL_006d: callvirt instance string [mscorlib]System.Object::ToString()
- IL_0072: stloc.1
- IL_0073: br.s IL_0075
-
- IL_0075: ldloc.1
- IL_0076: ret
- } // end of method '<>f__AnonymousType3`3'::ToString
-
- .method public hidebysig virtual instance bool
- Equals(object 'value') cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 89 (0x59)
- .maxstack 3
- .locals init (class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'> V_0,
- bool V_1)
- IL_0000: ldarg.1
- IL_0001: isinst class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>
- IL_0006: stloc.0
- IL_0007: ldloc.0
- IL_0008: brfalse.s IL_0052
-
- IL_000a: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_000f: ldarg.0
- IL_0010: ldfld !0 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0015: ldloc.0
- IL_0016: ldfld !0 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_001b: callvirt instance bool class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::Equals(!0,
- !0)
- IL_0020: brfalse.s IL_0052
-
- IL_0022: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_0027: ldarg.0
- IL_0028: ldfld !1 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_002d: ldloc.0
- IL_002e: ldfld !1 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0033: callvirt instance bool class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::Equals(!0,
- !0)
- IL_0038: brfalse.s IL_0052
-
- IL_003a: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_003f: ldarg.0
- IL_0040: ldfld !2 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0045: ldloc.0
- IL_0046: ldfld !2 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_004b: callvirt instance bool class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::Equals(!0,
- !0)
- IL_0050: br.s IL_0053
-
- IL_0052: ldc.i4.0
- IL_0053: nop
- IL_0054: stloc.1
- IL_0055: br.s IL_0057
-
- IL_0057: ldloc.1
- IL_0058: ret
- } // end of method '<>f__AnonymousType3`3'::Equals
-
- .method public hidebysig virtual instance int32
- GetHashCode() cil managed
- {
- .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
- // Code size 87 (0x57)
- .maxstack 3
- .locals init (int32 V_0,
- int32 V_1)
- IL_0000: ldc.i4 0xd0c61e6a
- IL_0005: stloc.0
- IL_0006: ldc.i4 0xa5555529
- IL_000b: ldloc.0
- IL_000c: mul
- IL_000d: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_0012: ldarg.0
- IL_0013: ldfld !0 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0018: callvirt instance int32 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::GetHashCode(!0)
- IL_001d: add
- IL_001e: stloc.0
- IL_001f: ldc.i4 0xa5555529
- IL_0024: ldloc.0
- IL_0025: mul
- IL_0026: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_002b: ldarg.0
- IL_002c: ldfld !1 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_0031: callvirt instance int32 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::GetHashCode(!0)
- IL_0036: add
- IL_0037: stloc.0
- IL_0038: ldc.i4 0xa5555529
- IL_003d: ldloc.0
- IL_003e: mul
- IL_003f: call class [mscorlib]System.Collections.Generic.EqualityComparer`1 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::get_Default()
- IL_0044: ldarg.0
- IL_0045: ldfld !2 class '<>f__AnonymousType3`3'j__TPar',!'j__TPar',!'j__TPar'>::'i__Field'
- IL_004a: callvirt instance int32 class [mscorlib]System.Collections.Generic.EqualityComparer`1j__TPar'>::GetHashCode(!0)
- IL_004f: add
- IL_0050: stloc.0
- IL_0051: ldloc.0
- IL_0052: stloc.1
- IL_0053: br.s IL_0055
-
- IL_0055: ldloc.1
- IL_0056: ret
- } // end of method '<>f__AnonymousType3`3'::GetHashCode
-
- .property instance !'j__TPar' X()
- {
- .get instance !'j__TPar' '<>f__AnonymousType3`3'::get_X()
- } // end of property '<>f__AnonymousType3`3'::X
- .property instance !'j__TPar' Y()
- {
- .get instance !'j__TPar' '<>f__AnonymousType3`3'::get_Y()
- } // end of property '<>f__AnonymousType3`3'::Y
- .property instance !'j__TPar' Z()
- {
- .get instance !'j__TPar' '<>f__AnonymousType3`3'::get_Z()
- } // end of property '<>f__AnonymousType3`3'::Z
-} // end of class '<>f__AnonymousType3`3'
-
-
-// =============================================================
-
-// *********** DISASSEMBLY COMPLETE ***********************
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.mcs.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.mcs.il
deleted file mode 100644
index 65f9824ae..000000000
--- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.mcs.il
+++ /dev/null
@@ -1,879 +0,0 @@
-
-
-
-
-// Metadata version: v2.0.50727
-.assembly extern mscorlib
-{
- .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
- .ver 2:0:0:0
-}
-.assembly AnonymousTypes.mcs
-{
- .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.
- .permissionset reqmin
- bytearray (3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // <.P.e.r.m.i.s.s.
- 69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00 // i.o.n.S.e.t. .c.
- 6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00 // l.a.s.s.=.".S.y.
- 73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00 // s.t.e.m...S.e.c.
- 75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00 // u.r.i.t.y...P.e.
- 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
- 53 00 65 00 74 00 22 00 0D 00 0A 00 76 00 65 00 // S.e.t.".....v.e.
- 72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 // r.s.i.o.n.=.".1.
- 22 00 3E 00 0D 00 0A 00 3C 00 49 00 50 00 65 00 // ".>.....<.I.P.e.
- 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
- 20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00 // .c.l.a.s.s.=.".
- 53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00 // S.y.s.t.e.m...S.
- 65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00 // e.c.u.r.i.t.y...
- 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00 // P.e.r.m.i.s.s.i.
- 6F 00 6E 00 73 00 2E 00 53 00 65 00 63 00 75 00 // o.n.s...S.e.c.u.
- 72 00 69 00 74 00 79 00 50 00 65 00 72 00 6D 00 // r.i.t.y.P.e.r.m.
- 69 00 73 00 73 00 69 00 6F 00 6E 00 2C 00 20 00 // i.s.s.i.o.n.,. .
- 6D 00 73 00 63 00 6F 00 72 00 6C 00 69 00 62 00 // m.s.c.o.r.l.i.b.
- 2C 00 20 00 56 00 65 00 72 00 73 00 69 00 6F 00 // ,. .V.e.r.s.i.o.
- 6E 00 3D 00 32 00 2E 00 30 00 2E 00 30 00 2E 00 // n.=.2...0...0...
- 30 00 2C 00 20 00 43 00 75 00 6C 00 74 00 75 00 // 0.,. .C.u.l.t.u.
- 72 00 65 00 3D 00 6E 00 65 00 75 00 74 00 72 00 // r.e.=.n.e.u.t.r.
- 61 00 6C 00 2C 00 20 00 50 00 75 00 62 00 6C 00 // a.l.,. .P.u.b.l.
- 69 00 63 00 4B 00 65 00 79 00 54 00 6F 00 6B 00 // i.c.K.e.y.T.o.k.
- 65 00 6E 00 3D 00 62 00 37 00 37 00 61 00 35 00 // e.n.=.b.7.7.a.5.
- 63 00 35 00 36 00 31 00 39 00 33 00 34 00 65 00 // c.5.6.1.9.3.4.e.
- 30 00 38 00 39 00 22 00 0D 00 0A 00 76 00 65 00 // 0.8.9.".....v.e.
- 72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 // r.s.i.o.n.=.".1.
- 22 00 0D 00 0A 00 46 00 6C 00 61 00 67 00 73 00 // ".....F.l.a.g.s.
- 3D 00 22 00 53 00 6B 00 69 00 70 00 56 00 65 00 // =.".S.k.i.p.V.e.
- 72 00 69 00 66 00 69 00 63 00 61 00 74 00 69 00 // r.i.f.i.c.a.t.i.
- 6F 00 6E 00 22 00 2F 00 3E 00 0D 00 0A 00 3C 00 // o.n."./.>.....<.
- 2F 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // /.P.e.r.m.i.s.s.
- 69 00 6F 00 6E 00 53 00 65 00 74 00 3E 00 0D 00 // i.o.n.S.e.t.>...
- 0A 00 )
- .hash algorithm 0x00008004
- .ver 0:0:0:0
-}
-.module AnonymousTypes.mcs.dll
-.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
-
-
-// =============== CLASS MEMBERS DECLARATION ===================
-
-.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.AnonymousTypes
- extends [mscorlib]System.Object
-{
- .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 AnonymousTypes::.ctor
-
- .method private hidebysig instance void
- SimpleTypes() cil managed
- {
- // Code size 58 (0x3a)
- .maxstack 11
- .locals init (class '<>__AnonType0' V_0,
- class '<>__AnonType1`1'