From 7b8ee049a151204997eecf587c69acc2f67c8405 Mon Sep 17 00:00:00 2001 From: Sergey Aseev Date: Thu, 18 Mar 2021 01:59:38 +0300 Subject: [PATCH] Issues #710: Ability to load debug symbols from MemoryStream (#735) --- Mono.Cecil.Cil/PortablePdb.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Mono.Cecil.Cil/PortablePdb.cs b/Mono.Cecil.Cil/PortablePdb.cs index b5515ba91..744c274bb 100644 --- a/Mono.Cecil.Cil/PortablePdb.cs +++ b/Mono.Cecil.Cil/PortablePdb.cs @@ -301,7 +301,11 @@ public ImageDebugHeader GetDebugHeader () // PDB Age buffer.WriteUInt32 (1); // PDB Path - buffer.WriteBytes (System.Text.Encoding.UTF8.GetBytes (writer.BaseStream.GetFileName ())); + var fileName = writer.BaseStream.GetFileName (); + if (string.IsNullOrEmpty (fileName)) { + fileName = module.Assembly.Name.Name + ".pdb"; + } + buffer.WriteBytes (System.Text.Encoding.UTF8.GetBytes (fileName)); buffer.WriteByte (0); var data = new byte [buffer.length];