ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

Build Error: StandardPerformanceCounter IDisposable

Open TimothyMothra opened this issue 5 years ago • 5 comments

Build system is throwing this error intermittently. Need to confirm this change is made in the code.

##[error]WEB\Src\PerformanceCollector\PerformanceCollector\Implementation\StandardPerformanceCollector\StandardPerformanceCounter.cs(12,36): Error CA2213: 'StandardPerformanceCounter' contains field 'performanceCounter' that is of IDisposable type 'PerformanceCounter', but it is never disposed. Change the Dispose method on 'StandardPerformanceCounter' to call Close or Dispose on this field.

TimothyMothra avatar Sep 15 '20 17:09 TimothyMothra

https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/WEB/Src/PerformanceCollector/PerformanceCollector/Implementation/StandardPerformanceCollector/StandardPerformanceCollector.cs#L313

cijothomas avatar Sep 15 '20 19:09 cijothomas

This is happening sometimes for some files. And every file that I saw was disposing correctly.

eddynaka avatar Sep 16 '20 11:09 eddynaka

I saw this error on our DEVELOP branch. I don't see any fields of type PerformanceCounter in this class. But the field in the exception performanceCounter is not being disposed. However, it's a List so it shouldn't need to be disposed.

TimothyMothra avatar Sep 16 '20 16:09 TimothyMothra

After I updated the packages, I left this TODOs:

  • BASE/src/Microsoft.ApplicationInsights/Metrics/Implementation/ConcurrentDatastructures/MultidimensionalCube2.cs, Line 261
  • WEB/Src/PerformanceCollector/PerformanceCollector/PerformanceCollectorModule.cs, Line 275

eddynaka avatar Sep 23 '20 19:09 eddynaka

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jan 04 '22 00:01 github-actions[bot]

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Nov 01 '22 00:11 github-actions[bot]