Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

QuickPulseTelemetryModule.Dispose should not throw if module is not initialized #1170

Merged
merged 4 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Version 2.10.0-beta3
- [Fix: QuickPulseTelemetryModule.Dispose should not throw if module was not initialized](https://github.com/Microsoft/ApplicationInsights-dotnet-server/pull/1170)
- Added NetStandard2.0 Target for PerfCounter project.
- Added support for PerfCounters for .Net Core Apps in Windows.
- Updated Base SDK to 2.10.0-beta3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ public void QuickPulseTelemetryModuleIsInitializedBySdk()
new QuickPulseTelemetryModule().Initialize(configuration);
}

[TestMethod]
public void QuickPulseTelemetryModuleDisposeWithoutInitialize()
{
var qp = new QuickPulseTelemetryModule();
qp.Dispose();
}

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void QuickPulseTelemetryModuleDoesNotRegisterNullProcessor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,11 @@ private void Dispose(bool disposing)
{
Interlocked.Exchange(ref this.stateThread, null)?.Stop(wait: true);
Interlocked.Exchange(ref this.collectionThread, null)?.Stop(wait: true);
this.serviceClient.Dispose();

if (this.serviceClient != null)
{
this.serviceClient.Dispose();
}
}
}
}
Expand Down