@@ -321,7 +321,7 @@ public static string CurrentTestName(ITestOutputHelper outputHelper)
321321 //
322322 // We only want the ClassName.MethodName portion.
323323 //
324- Match match = _testNameRegex . Match ( test . DisplayName ) ;
324+ Match match = TestNameRegex . Match ( test . DisplayName ) ;
325325 Assert . True ( match . Success ) ;
326326 // There should be 2 groups: the overall match, and the capture
327327 // group.
@@ -331,10 +331,10 @@ public static string CurrentTestName(ITestOutputHelper outputHelper)
331331 return match . Groups [ 1 ] . Value ;
332332 }
333333
334- private static Regex _testNameRegex = new (
334+ private static readonly Regex TestNameRegex = new (
335335 // Capture the ClassName.MethodName portion, which may terminate
336336 // the name, or have (args...) appended.
337- @"\.((?:[^.]+)\.(?:[^\ .\(]+))(?:\(.*\))?$" ,
337+ @"\.((?:[^.]+)\.(?:[^.\(]+))(?:\(.*\))?$" ,
338338 RegexOptions . Compiled ) ;
339339
340340 /// <summary>
@@ -1308,7 +1308,8 @@ protected virtual void OnMatchingEventWritten(EventWrittenEventArgs eventData)
13081308 // True if connected to an Azure SQL instance.
13091309 private readonly bool _isAzureSql ;
13101310
1311- // True if connected to a non-Azure SQL Server version 17 or higher.
1311+ // True if connected to a non-Azure SQL Server 2025 (version 17) or
1312+ // higher.
13121313 private readonly bool _isVersion17OrHigher ;
13131314
13141315 // Duration for the XEvent session, in minutes.
@@ -1351,18 +1352,21 @@ public XEventScope(
13511352
13521353 // Determine if we're connected to a SQL Server instance version
13531354 // 17 or higher.
1354- int majorVersion ;
1355- Assert . True (
1356- int . TryParse (
1357- GetSqlServerProperty ( connection , ServerProperty . ProductMajorVersion ) ,
1358- out majorVersion ) ) ;
1359- _isVersion17OrHigher = majorVersion >= 17 ;
1355+ if ( ! _isAzureSql )
1356+ {
1357+ int majorVersion ;
1358+ Assert . True (
1359+ int . TryParse (
1360+ GetSqlServerProperty ( connection , ServerProperty . ProductMajorVersion ) ,
1361+ out majorVersion ) ) ;
1362+ _isVersion17OrHigher = majorVersion >= 17 ;
1363+ }
13601364
13611365 // Setup and start the XEvent session.
13621366 string sessionLocation = _isAzureSql ? "DATABASE" : "SERVER" ;
13631367
1364- // Both Azure SQL and SQL Server 2025 (v17.x) and higher support
1365- // setting a maximum duration for the XEvent session.
1368+ // Both Azure SQL and SQL Server 2025+ support setting a maximum
1369+ // duration for the XEvent session.
13661370 string duration =
13671371 _isAzureSql || _isVersion17OrHigher
13681372 ? $ "MAX_DURATION={ _durationInMinutes } MINUTES,"
0 commit comments