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()
493
493
494
494
private PerformanceCounter ? CreatePerformanceCounter ( string counterName , PerformanceCounterType counterType )
495
495
{
496
- PerformanceCounter ? instance = null ;
497
-
498
496
_instanceName ??= GetInstanceName ( ) ;
499
497
try
500
498
{
501
- instance = new PerformanceCounter ( ) ;
499
+ PerformanceCounter instance = new ( ) ;
502
500
instance . CategoryName = PerformanceCounterCategoryName ;
503
501
instance . CounterName = counterName ;
504
502
instance . InstanceName = _instanceName ;
505
503
instance . InstanceLifetime = PerformanceCounterInstanceLifetime . Process ;
506
504
instance . ReadOnly = false ;
507
505
instance . RawValue = 0 ; // make sure we start out at zero
506
+
507
+ return instance ;
508
508
}
509
509
catch ( InvalidOperationException e )
510
510
{
511
511
ADP . TraceExceptionWithoutRethrow ( e ) ;
512
- }
513
512
514
- return instance ;
513
+ return null ;
514
+ }
515
515
}
516
516
517
517
// SxS: this method uses GetCurrentProcessId to construct the instance name.
You can’t perform that action at this time.
0 commit comments