Skip to content

Commit 8889596

Browse files
committed
read symbols from symbol stream when creating assembly defn
1 parent 012627a commit 8889596

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

NetcodePatcher/CodeGen/NetcodeILPPApplicator.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ public void ApplyProcesses()
133133
assembly = ApplyProcess<INetworkMessageILPP>(assembly);
134134
assembly = ApplyProcess<INetworkSerializableILPP>(assembly);
135135
assembly = ApplyProcess<ApplyPatchedAttributeILPP>(assembly);
136-
137-
var outputAssemblyName = Path.GetFileNameWithoutExtension(OutputPath);
138-
var outputDirectoryName = Path.GetDirectoryName(OutputPath)!;
139-
var outputPdbPath = Path.Combine(outputDirectoryName, $"{outputAssemblyName}.pdb");
140136

141137
if (!debugSymbolsAreEmbedded)
142138
{
139+
var outputAssemblyName = Path.GetFileNameWithoutExtension(OutputPath);
140+
var outputDirectoryName = Path.GetDirectoryName(OutputPath)!;
141+
var outputPdbPath = Path.Combine(outputDirectoryName, $"{outputAssemblyName}.pdb");
142+
143143
// save the weaved assembly to file.
144144
// some tests open it and check for certain IL code.
145145
File.WriteAllBytes(OutputPath, assembly.InMemoryAssembly.PeData);
@@ -150,11 +150,14 @@ public void ApplyProcesses()
150150
using var peStream = new MemoryStream(assembly.InMemoryAssembly.PeData);
151151
using var symbolStream = new MemoryStream(assembly.InMemoryAssembly.PdbData);
152152

153-
var assemblyDefinition = AssemblyDefinition.ReadAssembly(peStream);
153+
var assemblyDefinition = AssemblyDefinition.ReadAssembly(peStream, new ReaderParameters()
154+
{
155+
ReadSymbols = true,
156+
SymbolStream = symbolStream
157+
});
154158

155-
assemblyDefinition.Write(OutputPath , new WriterParameters
159+
assemblyDefinition.Write(OutputPath, new WriterParameters
156160
{
157-
SymbolStream = symbolStream,
158161
WriteSymbols = true
159162
});
160163

0 commit comments

Comments
 (0)