Skip to content

Commit 2cec03f

Browse files
Copilotbrianrob
andauthored
Fix null reference exception in GenFragmentationPercent method (#2211)
* Initial plan for issue * Fix GenFragmentationPercent null reference exception by adding HeapStats null check Co-authored-by: brianrob <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: brianrob <[email protected]>
1 parent bee605b commit 2cec03f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/TraceEvent/Computers/TraceManagedProcess.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,6 +2193,11 @@ public double SurvivalPercent(Gens gen)
21932193
/// <returns></returns>
21942194
public double GenSizeAfterMB(Gens gen)
21952195
{
2196+
if (HeapStats == null)
2197+
{
2198+
return double.NaN;
2199+
}
2200+
21962201
if (gen == Gens.GenPinObj)
21972202
{
21982203
return HeapStats.GenerationSize4 / 1000000.0;

0 commit comments

Comments
 (0)