提交 0ba5174c 编写于 作者: S Siegfried Pammer

Add comment about language version used during decompilation.

上级 cd7e1667
...@@ -225,11 +225,13 @@ private async Task<Document> DecompileSymbolAsync(Document temporaryDocument, IS ...@@ -225,11 +225,13 @@ private async Task<Document> DecompileSymbolAsync(Document temporaryDocument, IS
} }
// Load the assembly. // Load the assembly.
// TODO: Use a different PEFile overload that allows us to reuse the PEReader or Stream already created by Roslyn. // TODO: Use a different PEFile ctor overload that allows us to reuse the PEReader or Stream already created by Roslyn.
var pefile = new PEFile(assemblyLocation, PEStreamOptions.PrefetchEntireImage); var pefile = new PEFile(assemblyLocation, PEStreamOptions.PrefetchEntireImage);
// Initialize a decompiler with default settings. // Initialize a decompiler with default settings.
var decompiler = new CSharpDecompiler(pefile, new RoslynAssemblyResolver(compilation), new DecompilerSettings()); // TODO: Use language version currently used by the project.
var settings = new DecompilerSettings(LanguageVersion.Latest);
var decompiler = new CSharpDecompiler(pefile, new RoslynAssemblyResolver(compilation), settings);
// Escape invalid identifiers to prevent Roslyn from failing to parse the generated code. // Escape invalid identifiers to prevent Roslyn from failing to parse the generated code.
// (This happens for example, when there is compiler-generated code that is not yet recognized/transformed by the decompiler.) // (This happens for example, when there is compiler-generated code that is not yet recognized/transformed by the decompiler.)
decompiler.AstTransforms.Add(new EscapeInvalidIdentifiers()); decompiler.AstTransforms.Add(new EscapeInvalidIdentifiers());
...@@ -287,7 +289,7 @@ public PEFile Resolve(IAssemblyReference name) ...@@ -287,7 +289,7 @@ public PEFile Resolve(IAssemblyReference name)
// reference assemblies should be fine here, we only need the metadata of references. // reference assemblies should be fine here, we only need the metadata of references.
var reference = parentCompilation.GetMetadataReference(assembly); var reference = parentCompilation.GetMetadataReference(assembly);
// TODO: Use a different PEFile overload that allows us to reuse the PEReader or Stream already created by Roslyn. // TODO: Use a different PEFile ctor overload that allows us to reuse the PEReader or Stream already created by Roslyn.
return new PEFile(reference.Display, PEStreamOptions.PrefetchMetadata); return new PEFile(reference.Display, PEStreamOptions.PrefetchMetadata);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册