Skip to content

Commit

Permalink
#1674: Add DebugInfoProvider to WholeProjectDecompiler API.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Aug 27, 2019
1 parent 76a8a44 commit be887d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs
Expand Up @@ -36,6 +36,7 @@
using static ICSharpCode.Decompiler.Metadata.MetadataExtensions;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.Solution;
using ICSharpCode.Decompiler.DebugInfo;

namespace ICSharpCode.Decompiler.CSharp
{
Expand Down Expand Up @@ -73,6 +74,8 @@ public class WholeProjectDecompiler

public IAssemblyResolver AssemblyResolver { get; set; }

public IDebugInfoProvider DebugInfoProvider { get; set; }

/// <summary>
/// The MSBuild ProjectGuid to use for the new project.
/// <c>null</c> to automatically generate a new GUID.
Expand Down Expand Up @@ -322,6 +325,7 @@ protected virtual bool IncludeTypeWhenDecompilingProject(Metadata.PEFile module,
CSharpDecompiler CreateDecompiler(DecompilerTypeSystem ts)
{
var decompiler = new CSharpDecompiler(ts, settings);
decompiler.DebugInfoProvider = DebugInfoProvider;
decompiler.AstTransforms.Add(new EscapeInvalidIdentifiers());
decompiler.AstTransforms.Add(new RemoveCLSCompliantAttribute());
return decompiler;
Expand Down
1 change: 1 addition & 0 deletions ILSpy/Languages/CSharpLanguage.cs
Expand Up @@ -432,6 +432,7 @@ public ILSpyWholeProjectDecompiler(LoadedAssembly assembly, DecompilationOptions
this.options = options;
base.Settings = options.DecompilerSettings;
base.AssemblyResolver = assembly.GetAssemblyResolver();
base.DebugInfoProvider = assembly.GetDebugInfoOrNull();
}

protected override IEnumerable<Tuple<string, string>> WriteResourceToFile(string fileName, string resourceName, Stream entryStream)
Expand Down

0 comments on commit be887d0

Please sign in to comment.