Skip to content

Commit 226f120

Browse files
Copilotbrianrob
andcommitted
Always assign providersByName to avoid NullReferenceException
Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com>
1 parent 0e6fadb commit 226f120

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/TraceEvent/TraceEventSession.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,9 +1796,10 @@ internal static SortedDictionary<string, Guid> ProviderNameToGuid
17961796
var name = new string((char*)&buffer[providers[i].ProviderNameOffset]);
17971797
providersByName[name] = providers[i].ProviderGuid;
17981798
}
1799-
1800-
s_providersByName = providersByName;
18011799
}
1800+
1801+
// Always assign providersByName to avoid NullReferenceException on subsequent lookups
1802+
s_providersByName = providersByName;
18021803
}
18031804
}
18041805
}

0 commit comments

Comments
 (0)