File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -489,25 +489,25 @@ private void RemovePerformanceCounters()
489489
490490 private PerformanceCounter ? CreatePerformanceCounter ( string counterName , PerformanceCounterType counterType )
491491 {
492- PerformanceCounter ? instance = null ;
493-
494492 _instanceName ??= GetInstanceName ( ) ;
495493 try
496494 {
497- instance = new PerformanceCounter ( ) ;
495+ PerformanceCounter instance = new ( ) ;
498496 instance . CategoryName = PerformanceCounterCategoryName ;
499497 instance . CounterName = counterName ;
500498 instance . InstanceName = _instanceName ;
501499 instance . InstanceLifetime = PerformanceCounterInstanceLifetime . Process ;
502500 instance . ReadOnly = false ;
503501 instance . RawValue = 0 ; // make sure we start out at zero
502+
503+ return instance ;
504504 }
505505 catch ( InvalidOperationException e )
506506 {
507507 ADP . TraceExceptionWithoutRethrow ( e ) ;
508- }
509508
510- return instance ;
509+ return null ;
510+ }
511511 }
512512
513513 // SxS: this method uses GetCurrentProcessId to construct the instance name.
You can’t perform that action at this time.
0 commit comments