Skip to content

Commit

Permalink
Added null checks for GetCachedExtensions call (#3639)
Browse files Browse the repository at this point in the history
  • Loading branch information
cvpoienaru authored May 12, 2022
1 parent 806cbe8 commit 4ea48c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete
// and then we write again here. We should refactor this code and write only once.
discoveryCompleteEventArgs.DiscoveredExtensions = TestExtensions.CreateMergedDictionary(
discoveryCompleteEventArgs.DiscoveredExtensions,
TestPluginCache.Instance.TestExtensions.GetCachedExtensions());
TestPluginCache.Instance.TestExtensions?.GetCachedExtensions());

if (RequestData.IsTelemetryOptedIn)
{
Expand Down Expand Up @@ -436,7 +436,7 @@ private string UpdateRawMessageWithTelemetryInfo(DiscoveryCompletePayload discov
// would probably mean a performance hit.
discoveryCompletePayload.DiscoveredExtensions = TestExtensions.CreateMergedDictionary(
discoveryCompletePayload.DiscoveredExtensions,
TestPluginCache.Instance.TestExtensions.GetCachedExtensions());
TestPluginCache.Instance.TestExtensions?.GetCachedExtensions());

// Write extensions to telemetry data.
TestExtensions.AddExtensionTelemetry(
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public void HandleTestRunComplete(TestRunCompleteEventArgs runCompleteArgs!!, Te
// and then we write again here. We should refactor this code and write only once.
runCompleteArgs.DiscoveredExtensions = TestExtensions.CreateMergedDictionary(
runCompleteArgs.DiscoveredExtensions,
TestPluginCache.Instance.TestExtensions.GetCachedExtensions());
TestPluginCache.Instance.TestExtensions?.GetCachedExtensions());

if (_requestData.IsTelemetryOptedIn)
{
Expand Down Expand Up @@ -613,7 +613,7 @@ private string UpdateRawMessageWithTelemetryInfo(TestRunCompletePayload testRunC
// would probably mean a performance hit.
testRunCompletePayload.TestRunCompleteArgs.DiscoveredExtensions = TestExtensions.CreateMergedDictionary(
testRunCompletePayload.TestRunCompleteArgs.DiscoveredExtensions,
TestPluginCache.Instance.TestExtensions.GetCachedExtensions());
TestPluginCache.Instance.TestExtensions?.GetCachedExtensions());

// Write extensions to telemetry data.
TestExtensions.AddExtensionTelemetry(
Expand Down

0 comments on commit 4ea48c7

Please sign in to comment.