@@ -26,39 +26,39 @@ public static class CommonInterest
2626 public static readonly Regex FileNamePatternForMethodsThatAssertMainThread = new Regex ( @"^vs-threading\.MainThreadAssertingMethods(\..*)?.txt$" , FileNamePatternRegexOptions ) ;
2727 public static readonly Regex FileNamePatternForMethodsThatSwitchToMainThread = new Regex ( @"^vs-threading\.MainThreadSwitchingMethods(\..*)?.txt$" , FileNamePatternRegexOptions ) ;
2828
29- public static readonly IEnumerable < SyncBlockingMethod > JTFSyncBlockers = new [ ]
30- {
29+ public static readonly IEnumerable < SyncBlockingMethod > JTFSyncBlockers =
30+ [
3131 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioThreading , Types . JoinableTaskFactory . TypeName ) , Types . JoinableTaskFactory . Run ) , Types . JoinableTaskFactory . RunAsync ) ,
3232 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioThreading , Types . JoinableTask . TypeName ) , Types . JoinableTask . Join ) , Types . JoinableTask . JoinAsync ) ,
33- } ;
33+ ] ;
3434
35- public static readonly IEnumerable < SyncBlockingMethod > ProblematicSyncBlockingMethods = new [ ]
36- {
35+ public static readonly IEnumerable < SyncBlockingMethod > ProblematicSyncBlockingMethods =
36+ [
3737 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task . Wait ) ) , null ) ,
3838 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task . WaitAll ) ) , null ) ,
3939 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task . WaitAny ) ) , null ) ,
4040 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( ConfiguredTaskAwaitable . ConfiguredTaskAwaiter ) ) , nameof ( ConfiguredTaskAwaitable . ConfiguredTaskAwaiter . GetResult ) ) , null ) ,
4141 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( TaskAwaiter ) ) , nameof ( TaskAwaiter . GetResult ) ) , null ) ,
4242 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( ValueTaskAwaiter ) ) , nameof ( ValueTaskAwaiter . GetResult ) ) , null ) ,
4343 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemRuntimeCompilerServices , nameof ( ConfiguredValueTaskAwaitable . ConfiguredValueTaskAwaiter ) ) , nameof ( ConfiguredValueTaskAwaitable . ConfiguredValueTaskAwaiter . GetResult ) ) , null ) ,
44- } ;
44+ ] ;
4545
46- public static readonly IEnumerable < SyncBlockingMethod > SyncBlockingMethods = JTFSyncBlockers . Concat ( ProblematicSyncBlockingMethods ) . Concat ( new [ ]
47- {
46+ public static readonly IEnumerable < SyncBlockingMethod > SyncBlockingMethods = JTFSyncBlockers . Concat ( ProblematicSyncBlockingMethods ) . Concat (
47+ [
4848 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioShellInterop , "IVsTask" ) , "Wait" ) , extensionMethodNamespace : Namespaces . MicrosoftVisualStudioShell ) ,
4949 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioShellInterop , "IVsTask" ) , "GetResult" ) , extensionMethodNamespace : Namespaces . MicrosoftVisualStudioShell ) ,
50- } ) ;
50+ ] ) ;
5151
52- public static readonly IReadOnlyList < SyncBlockingMethod > SyncBlockingProperties = new [ ]
53- {
52+ public static readonly ImmutableArray < SyncBlockingMethod > SyncBlockingProperties =
53+ [
5454 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( Task ) ) , nameof ( Task < int > . Result ) ) , null ) ,
5555 new SyncBlockingMethod ( new QualifiedMember ( new QualifiedType ( Namespaces . SystemThreadingTasks , nameof ( ValueTask ) ) , nameof ( ValueTask < int > . Result ) ) , null ) ,
56- } ;
56+ ] ;
5757
58- public static readonly IEnumerable < QualifiedMember > ThreadAffinityTestingMethods = new [ ]
59- {
58+ public static readonly IEnumerable < QualifiedMember > ThreadAffinityTestingMethods =
59+ [
6060 new QualifiedMember ( new QualifiedType ( Namespaces . MicrosoftVisualStudioShell , Types . ThreadHelper . TypeName ) , Types . ThreadHelper . CheckAccess ) ,
61- } ;
61+ ] ;
6262
6363 public static readonly ImmutableArray < QualifiedMember > TaskConfigureAwait = ImmutableArray . Create (
6464 new QualifiedMember ( new QualifiedType ( Types . Task . Namespace , Types . Task . TypeName ) , nameof ( Task . ConfigureAwait ) ) ,
@@ -77,7 +77,7 @@ public static class CommonInterest
7777 /// <summary>
7878 /// An array with '.' as its only element.
7979 /// </summary>
80- private static readonly char [ ] QualifiedIdentifierSeparators = new [ ] { '.' } ;
80+ private static readonly char [ ] QualifiedIdentifierSeparators = [ '.' ] ;
8181
8282 public static IEnumerable < QualifiedMember > ReadMethods ( AnalyzerOptions analyzerOptions , Regex fileNamePattern , CancellationToken cancellationToken )
8383 {
@@ -421,7 +421,7 @@ public TypeMatchSpec(QualifiedType type, QualifiedMember member, bool inverted)
421421 public QualifiedMember Member { get ; }
422422
423423 /// <summary>
424- /// Gets a value indicating whether a member match is reuqired .
424+ /// Gets a value indicating whether a member match is required .
425425 /// </summary>
426426 public bool IsMember => this . Member . Name is object ;
427427
@@ -433,7 +433,7 @@ public TypeMatchSpec(QualifiedType type, QualifiedMember member, bool inverted)
433433 /// <summary>
434434 /// Gets a value indicating whether this is an uninitialized (default) instance.
435435 /// </summary>
436- public bool IsEmpty => this . Type . Namespace is null ;
436+ public bool IsEmpty => this . Type . Name is null ;
437437
438438 /// <summary>
439439 /// Tests whether a given symbol matches the description of a type (independent of its <see cref="InvertedLogic"/> property).
@@ -466,13 +466,13 @@ public bool IsMatch([NotNullWhen(true)] ITypeSymbol? typeSymbol, ISymbol? member
466466
467467 public readonly struct QualifiedType
468468 {
469- public QualifiedType ( IReadOnlyList < string > containingTypeNamespace , string typeName )
469+ public QualifiedType ( ImmutableArray < string > containingTypeNamespace , string typeName )
470470 {
471471 this . Namespace = containingTypeNamespace ;
472472 this . Name = typeName ;
473473 }
474474
475- public IReadOnlyList < string > Namespace { get ; }
475+ public ImmutableArray < string > Namespace { get ; }
476476
477477 public string Name { get ; }
478478
@@ -482,7 +482,7 @@ public bool IsMatch(ISymbol symbol)
482482 && symbol . BelongsToNamespace ( this . Namespace ) ;
483483 }
484484
485- public override string ToString ( ) => string . Join ( "." , this . Namespace . Concat ( new [ ] { this . Name } ) ) ;
485+ public override string ToString ( ) => string . Join ( "." , this . Namespace . Concat ( [ this . Name ] ) ) ;
486486 }
487487
488488 public readonly struct QualifiedMember
@@ -509,7 +509,7 @@ public bool IsMatch(ISymbol? symbol)
509509 [ DebuggerDisplay ( "{" + nameof ( Method ) + "} -> {" + nameof ( AsyncAlternativeMethodName ) + "}" ) ]
510510 public readonly struct SyncBlockingMethod
511511 {
512- public SyncBlockingMethod ( QualifiedMember method , string ? asyncAlternativeMethodName = null , IReadOnlyList < string > ? extensionMethodNamespace = null )
512+ public SyncBlockingMethod ( QualifiedMember method , string ? asyncAlternativeMethodName = null , ImmutableArray < string > ? extensionMethodNamespace = null )
513513 {
514514 this . Method = method ;
515515 this . AsyncAlternativeMethodName = asyncAlternativeMethodName ;
@@ -520,7 +520,7 @@ public SyncBlockingMethod(QualifiedMember method, string? asyncAlternativeMethod
520520
521521 public string ? AsyncAlternativeMethodName { get ; }
522522
523- public IReadOnlyList < string > ? ExtensionMethodNamespace { get ; }
523+ public ImmutableArray < string > ? ExtensionMethodNamespace { get ; }
524524 }
525525
526526 public class AwaitableTypeTester
0 commit comments