@@ -34,19 +34,19 @@ public Dictionary<int, object> DebugData
3434 lock ( _debugDataLock )
3535 {
3636 // Use the cached data if possible
37- if ( _debugData . Count != 0 )
38- return _debugData ;
37+ if ( field . Count != 0 )
38+ return field ;
3939
4040 // If we have no resource table, just return
4141 if ( DebugDirectoryTable == null || DebugDirectoryTable . Length == 0 )
42- return _debugData ;
42+ return field ;
4343
4444 // Otherwise, build and return the cached dictionary
45- ParseDebugTable ( ) ;
46- return _debugData ;
45+ field = ParseDebugTable ( ) ;
46+ return field ;
4747 }
4848 }
49- }
49+ } = [ ] ;
5050
5151 /// <inheritdoc cref="Models.PortableExecutable.DebugData.Table.Table"/>
5252 public Data . Models . PortableExecutable . DebugData . Entry [ ] ? DebugDirectoryTable
@@ -822,12 +822,7 @@ public string? AssemblyVersion
822822 #region Instance Variables
823823
824824 /// <summary>
825- /// Cached debug data
826- /// </summary>
827- private readonly Dictionary < int , object > _debugData = [ ] ;
828-
829- /// <summary>
830- /// Lock object for <see cref="_debugData"/>
825+ /// Lock object for <see cref="DebugData"/>
831826 /// </summary>
832827 private readonly object _debugDataLock = new ( ) ;
833828
@@ -1200,11 +1195,14 @@ public PortableExecutable(Executable model, Stream data, long offset, long lengt
12001195 /// <summary>
12011196 /// Parse the debug directory table information
12021197 /// </summary>
1203- private void ParseDebugTable ( )
1198+ private Dictionary < int , object > ParseDebugTable ( )
12041199 {
12051200 // If there is no debug table
12061201 if ( DebugDirectoryTable == null || DebugDirectoryTable . Length == 0 )
1207- return ;
1202+ return [ ] ;
1203+
1204+ // Create a new debug table
1205+ Dictionary < int , object > debugData = [ ] ;
12081206
12091207 // Loop through all debug table entries
12101208 for ( int i = 0 ; i < DebugDirectoryTable . Length ; i ++ )
@@ -1223,7 +1221,7 @@ private void ParseDebugTable()
12231221 }
12241222 catch ( EndOfStreamException )
12251223 {
1226- return ;
1224+ return debugData ;
12271225 }
12281226
12291227 // If we have CodeView debug data, try to parse it
@@ -1242,7 +1240,7 @@ private void ParseDebugTable()
12421240 var nb10ProgramDatabase = entryData . ParseNB10ProgramDatabase ( ref offset ) ;
12431241 if ( nb10ProgramDatabase != null )
12441242 {
1245- _debugData [ i ] = nb10ProgramDatabase ;
1243+ debugData [ i ] = nb10ProgramDatabase ;
12461244 continue ;
12471245 }
12481246 }
@@ -1253,16 +1251,18 @@ private void ParseDebugTable()
12531251 var rsdsProgramDatabase = entryData . ParseRSDSProgramDatabase ( ref offset ) ;
12541252 if ( rsdsProgramDatabase != null )
12551253 {
1256- _debugData [ i ] = rsdsProgramDatabase ;
1254+ debugData [ i ] = rsdsProgramDatabase ;
12571255 continue ;
12581256 }
12591257 }
12601258 }
12611259 else
12621260 {
1263- _debugData [ i ] = entryData ;
1261+ debugData [ i ] = entryData ;
12641262 }
12651263 }
1264+
1265+ return debugData ;
12661266 }
12671267
12681268 #endregion
0 commit comments