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 @@ -493,25 +493,25 @@ private void RemovePerformanceCounters()
493493
494494 private PerformanceCounter ? CreatePerformanceCounter ( string counterName , PerformanceCounterType counterType )
495495 {
496- PerformanceCounter ? instance = null ;
497-
498496 _instanceName ??= GetInstanceName ( ) ;
499497 try
500498 {
501- instance = new PerformanceCounter ( ) ;
499+ PerformanceCounter instance = new ( ) ;
502500 instance . CategoryName = PerformanceCounterCategoryName ;
503501 instance . CounterName = counterName ;
504502 instance . InstanceName = _instanceName ;
505503 instance . InstanceLifetime = PerformanceCounterInstanceLifetime . Process ;
506504 instance . ReadOnly = false ;
507505 instance . RawValue = 0 ; // make sure we start out at zero
506+
507+ return instance ;
508508 }
509509 catch ( InvalidOperationException e )
510510 {
511511 ADP . TraceExceptionWithoutRethrow ( e ) ;
512- }
513512
514- return instance ;
513+ return null ;
514+ }
515515 }
516516
517517 // SxS: this method uses GetCurrentProcessId to construct the instance name.
You can’t perform that action at this time.
0 commit comments