@@ -27,39 +27,39 @@ public static class CommonInterest
2727 public static readonly Regex FileNamePatternForMethodsThatSwitchToMainThread = new Regex ( @"^vs-threading\.MainThreadSwitchingMethods(\..*)?.txt$" , FileNamePatternRegexOptions ) ;
2828 public static readonly Regex FileNamePatternForSyncMethodsToExcludeFromVSTHRD103 = new Regex ( @"^vs-threading\.SyncMethodsToExcludeFromVSTHRD103(\..*)?.txt$" , FileNamePatternRegexOptions ) ;
2929
30- public static readonly IEnumerable < SyncBlockingMethod > JTFSyncBlockers = new [ ]
31- {
30+ public static readonly IEnumerable < SyncBlockingMethod > JTFSyncBlockers =
31+ [
3232 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioThreading , Types . JoinableTaskFactory . TypeName ) , Types . JoinableTaskFactory . Run ) , Types . JoinableTaskFactory . RunAsync ) ,
3333 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioThreading , Types . JoinableTask . TypeName ) , Types . JoinableTask . Join ) , Types . JoinableTask . JoinAsync ) ,
34- } ;
34+ ] ;
3535
36- public static readonly IEnumerable < SyncBlockingMethod > ProblematicSyncBlockingMethods = new [ ]
37- {
36+ public static readonly IEnumerable < SyncBlockingMethod > ProblematicSyncBlockingMethods =
37+ [
3838 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task . Wait ) ) , null ) ,
3939 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task . WaitAll ) ) , null ) ,
4040 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task . WaitAny ) ) , null ) ,
4141 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( ConfiguredTaskAwaitable . ConfiguredTaskAwaiter ) ) , nameof ( ConfiguredTaskAwaitable . ConfiguredTaskAwaiter . GetResult ) ) , null ) ,
4242 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( TaskAwaiter ) ) , nameof ( TaskAwaiter . GetResult ) ) , null ) ,
4343 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( ValueTaskAwaiter ) ) , nameof ( ValueTaskAwaiter . GetResult ) ) , null ) ,
4444 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( ConfiguredValueTaskAwaitable . ConfiguredValueTaskAwaiter ) ) , nameof ( ConfiguredValueTaskAwaitable . ConfiguredValueTaskAwaiter . GetResult ) ) , null ) ,
45- } ;
45+ ] ;
4646
47- public static readonly IEnumerable < SyncBlockingMethod > SyncBlockingMethods = JTFSyncBlockers . Concat ( ProblematicSyncBlockingMethods ) . Concat ( new [ ]
48- {
47+ public static readonly IEnumerable < SyncBlockingMethod > SyncBlockingMethods = JTFSyncBlockers . Concat ( ProblematicSyncBlockingMethods ) . Concat (
48+ [
4949 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioShellInterop , "IVsTask" ) , "Wait" ) , extensionMethodNamespace : Namespaces . MicrosoftVisualStudioShell ) ,
5050 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioShellInterop , "IVsTask" ) , "GetResult" ) , extensionMethodNamespace : Namespaces . MicrosoftVisualStudioShell ) ,
51- } ) ;
51+ ] ) ;
5252
53- public static readonly IReadOnlyList < SyncBlockingMethod > SyncBlockingProperties = new [ ]
54- {
53+ public static readonly ImmutableArray < SyncBlockingMethod > SyncBlockingProperties =
54+ [
5555 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task < int > . Result ) ) , null ) ,
5656 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( ValueTask ) ) , nameof ( ValueTask < int > . Result ) ) , null ) ,
57- } ;
57+ ] ;
5858
59- public static readonly IEnumerable < QualifiedMember > ThreadAffinityTestingMethods = new [ ]
60- {
59+ public static readonly IEnumerable < QualifiedMember > ThreadAffinityTestingMethods =
60+ [
6161 new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioShell , Types . ThreadHelper . TypeName ) , Types . ThreadHelper . CheckAccess ) ,
62- } ;
62+ ] ;
6363
6464 public static readonly ImmutableArray < QualifiedMember > TaskConfigureAwait = ImmutableArray . Create (
6565 new QualifiedMember ( new QualifiedType ( Types . Task . Namespace , Types . Task . TypeName ) , nameof ( Task . ConfigureAwait ) ) ,
@@ -78,7 +78,7 @@ public static class CommonInterest
7878 /// <summary>
7979 /// An array with '.' as its only element.
8080 /// </summary>
81- private static readonly char [ ] QualifiedIdentifierSeparators = new [ ] { '.' } ;
81+ private static readonly char [ ] QualifiedIdentifierSeparators = [ '.' ] ;
8282
8383 public static IEnumerable < QualifiedMember > ReadMethods ( AnalyzerOptions analyzerOptions , Regex fileNamePattern , CancellationToken cancellationToken )
8484 {
@@ -422,7 +422,7 @@ public TypeMatchSpec(QualifiedType type, QualifiedMember member, bool inverted)
422422 public QualifiedMember Member { get ; }
423423
424424 /// <summary>
425- /// Gets a value indicating whether a member match is reuqired .
425+ /// Gets a value indicating whether a member match is required .
426426 /// </summary>
427427 public bool IsMember => this . Member . Name is object ;
428428
@@ -434,7 +434,7 @@ public TypeMatchSpec(QualifiedType type, QualifiedMember member, bool inverted)
434434 /// <summary>
435435 /// Gets a value indicating whether this is an uninitialized (default) instance.
436436 /// </summary>
437- public bool IsEmpty => this . Type . Namespace is null ;
437+ public bool IsEmpty => this . Type . Name is null ;
438438
439439 /// <summary>
440440 /// Tests whether a given symbol matches the description of a type (independent of its <see cref="InvertedLogic"/> property).
@@ -467,13 +467,13 @@ public bool IsMatch([NotNullWhen(true)] ITypeSymbol? typeSymbol, ISymbol? member
467467
468468 public readonly struct QualifiedType
469469 {
470- public QualifiedType ( IReadOnlyList < string > containingTypeNamespace , string typeName )
470+ public QualifiedType ( ImmutableArray < string > containingTypeNamespace , string typeName )
471471 {
472472 this . Namespace = containingTypeNamespace ;
473473 this . Name = typeName ;
474474 }
475475
476- public IReadOnlyList < string > Namespace { get ; }
476+ public ImmutableArray < string > Namespace { get ; }
477477
478478 public string Name { get ; }
479479
@@ -483,7 +483,7 @@ public bool IsMatch(ISymbol symbol)
483483 && symbol . BelongsToNamespace ( this . Namespace ) ;
484484 }
485485
486- public override string ToString ( ) => string . Join ( "." , this . Namespace . Concat ( new [ ] { this . Name } ) ) ;
486+ public override string ToString ( ) => string . Join ( "." , this . Namespace . Concat ( [ this . Name ] ) ) ;
487487 }
488488
489489 public readonly struct QualifiedMember
@@ -510,7 +510,7 @@ public bool IsMatch(ISymbol? symbol)
510510 [ DebuggerDisplay ( "{" + nameof ( Method ) + "} -> {" + nameof ( AsyncAlternativeMethodName ) + "}" ) ]
511511 public readonly struct SyncBlockingMethod
512512 {
513- public SyncBlockingMethod ( QualifiedMember method , string ? asyncAlternativeMethodName = null , IReadOnlyList < string > ? extensionMethodNamespace = null )
513+ public SyncBlockingMethod ( QualifiedMember method , string ? asyncAlternativeMethodName = null , ImmutableArray < string > ? extensionMethodNamespace = null )
514514 {
515515 this . Method = method ;
516516 this . AsyncAlternativeMethodName = asyncAlternativeMethodName ;
@@ -521,7 +521,7 @@ public SyncBlockingMethod(QualifiedMember method, string? asyncAlternativeMethod
521521
522522 public string ? AsyncAlternativeMethodName { get ; }
523523
524- public IReadOnlyList < string > ? ExtensionMethodNamespace { get ; }
524+ public ImmutableArray < string > ? ExtensionMethodNamespace { get ; }
525525 }
526526
527527 public class AwaitableTypeTester
0 commit comments