Rename analyzers to match current descriptions
This commit is contained in:
Родитель
be772dddef
Коммит
8b32bc6994
|
@ -18,7 +18,7 @@ ID | Title | Severity | Supports
|
|||
[VSTHRD104](VSTHRD104.md) | Offer async option | Advisory
|
||||
[VSTHRD105](VSTHRD105.md) | Avoid implicit use of TaskScheduler.Current | Advisory
|
||||
[VSTHRD106](VSTHRD106.md) | Use `InvokeAsync` to raise async events | Advisory
|
||||
[VSTHRD200](VSTHRD200.md) | `Async` naming convention | Guideline | [VSTHRD103](VSTHRD103.md)
|
||||
[VSTHRD200](VSTHRD200.md) | Use `Async` naming convention | Guideline | [VSTHRD103](VSTHRD103.md)
|
||||
|
||||
## Severity descriptions
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="VSTHRD106AsyncEventHandlerAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD200AsyncSuffixAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD200UseAsyncNamingConventionAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD101AsyncVoidLambdaAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD100AsyncVoidMethodAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD100AsyncVoidMethodCodeFixTests.cs" />
|
||||
<Compile Include="VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD102AvoidJtfRunInNonPublicMembersAnalyzerTests.cs" />
|
||||
<Compile Include="Helpers\CodeFixVerifier.cs" />
|
||||
<Compile Include="Helpers\CodeFixVerifier.Helper.cs" />
|
||||
|
@ -50,16 +50,16 @@
|
|||
<Compile Include="Helpers\DiagnosticResultLocation.cs" />
|
||||
<Compile Include="Helpers\DiagnosticVerifier.cs" />
|
||||
<Compile Include="Helpers\DiagnosticVerifier.Helper.cs" />
|
||||
<Compile Include="VSTHRD003JtfRunAwaitTaskAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD003UseJtfRunAsyncAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD011LazyOfTaskAnalyzerTests.cs" />
|
||||
<Compile Include="MultiAnalyzerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="VSTHRD002SynchronousWaitAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD103UseAwaitInAsyncMethodsAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD002UseJtfRunAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD103UseAsyncOptionAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD010VsServiceInvocationAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD012SpecifyJtfWhereAllowedTests.cs" />
|
||||
<Compile Include="VSTHRD104OfferAsyncOptionAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD001AvoidLegacyThreadSwitchingAnalyzerTests.cs" />
|
||||
<Compile Include="VSTHRD001UseSwitchToMainThreadAsyncAnalyzerTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.VisualStudio.Threading.Analyzers\Microsoft.VisualStudio.Threading.Analyzers.csproj">
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
protected override ImmutableArray<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers()
|
||||
{
|
||||
var analyzers = from type in typeof(VSTHRD002SynchronousWaitAnalyzer).Assembly.GetTypes()
|
||||
var analyzers = from type in typeof(VSTHRD002UseJtfRunAnalyzer).Assembly.GetTypes()
|
||||
where type.GetCustomAttributes(typeof(DiagnosticAnalyzerAttribute), true).Any()
|
||||
select (DiagnosticAnalyzer)Activator.CreateInstance(type);
|
||||
return analyzers.ToImmutableArray();
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD001AvoidLegacyThreadSwitchingAnalyzerTests : DiagnosticVerifier
|
||||
public class VSTHRD001UseSwitchToMainThreadAsyncAnalyzerTests : DiagnosticVerifier
|
||||
{
|
||||
private DiagnosticResult expect = new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD001AvoidLegacyThreadSwitchingAnalyzer.Id,
|
||||
Id = VSTHRD001UseSwitchToMainThreadAsyncAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
};
|
||||
|
||||
public VSTHRD001AvoidLegacyThreadSwitchingAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD001UseSwitchToMainThreadAsyncAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() => new VSTHRD001AvoidLegacyThreadSwitchingAnalyzer();
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() => new VSTHRD001UseSwitchToMainThreadAsyncAnalyzer();
|
||||
|
||||
[Fact]
|
||||
public void ThreadHelperInvoke_ProducesDiagnostic()
|
|
@ -6,23 +6,23 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD002SynchronousWaitAnalyzerTests : DiagnosticVerifier
|
||||
public class VSTHRD002UseJtfRunAnalyzerTests : DiagnosticVerifier
|
||||
{
|
||||
private DiagnosticResult expect = new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD002SynchronousWaitAnalyzer.Id,
|
||||
Id = VSTHRD002UseJtfRunAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
};
|
||||
|
||||
public VSTHRD002SynchronousWaitAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD002UseJtfRunAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
|
||||
{
|
||||
return new VSTHRD002SynchronousWaitAnalyzer();
|
||||
return new VSTHRD002UseJtfRunAnalyzer();
|
||||
}
|
||||
|
||||
/// <devremarks>
|
|
@ -6,23 +6,23 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD003JtfRunAwaitTaskAnalyzerTests : DiagnosticVerifier
|
||||
public class VSTHRD003UseJtfRunAsyncAnalyzerTests : DiagnosticVerifier
|
||||
{
|
||||
private DiagnosticResult expect = new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD003JtfRunAwaitTaskAnalyzer.Id,
|
||||
Id = VSTHRD003UseJtfRunAsyncAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
};
|
||||
|
||||
public VSTHRD003JtfRunAwaitTaskAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD003UseJtfRunAsyncAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
|
||||
{
|
||||
return new VSTHRD003JtfRunAwaitTaskAnalyzer();
|
||||
return new VSTHRD003UseJtfRunAsyncAnalyzer();
|
||||
}
|
||||
|
||||
[Fact]
|
|
@ -6,23 +6,23 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD103UseAwaitInAsyncMethodsAnalyzerTests : CodeFixVerifier
|
||||
public class VSTHRD103UseAsyncOptionAnalyzerTests : CodeFixVerifier
|
||||
{
|
||||
private DiagnosticResult expect = new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD103UseAwaitInAsyncMethodsAnalyzer.Id,
|
||||
Id = VSTHRD103UseAsyncOptionAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
};
|
||||
|
||||
public VSTHRD103UseAwaitInAsyncMethodsAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD103UseAsyncOptionAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() => new VSTHRD103UseAwaitInAsyncMethodsAnalyzer();
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() => new VSTHRD103UseAsyncOptionAnalyzer();
|
||||
|
||||
protected override CodeFixProvider GetCSharpCodeFixProvider() => new VSTHRD103UseAwaitInAsyncMethodsCodeFix();
|
||||
protected override CodeFixProvider GetCSharpCodeFixProvider() => new VSTHRD103UseAsyncOptionCodeFix();
|
||||
|
||||
[Fact]
|
||||
public void JTFRunInTaskReturningMethodGeneratesWarning()
|
|
@ -6,21 +6,21 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzerTests : DiagnosticVerifier
|
||||
public class VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzerTests : DiagnosticVerifier
|
||||
{
|
||||
private DiagnosticResult expect = new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzer.Id,
|
||||
Id = VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
};
|
||||
|
||||
public VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() => new VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzer();
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() => new VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzer();
|
||||
|
||||
[Fact]
|
||||
public void ContinueWith_NoTaskScheduler_GeneratesWarning()
|
|
@ -7,9 +7,9 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD106AsyncEventHandlerAnalyzerTests : DiagnosticVerifier
|
||||
public class VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzerTests : DiagnosticVerifier
|
||||
{
|
||||
public VSTHRD106AsyncEventHandlerAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
|||
{
|
||||
results[i] = new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD106AsyncEventHandlerAnalyzer.Id,
|
||||
Id = VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
Locations = new[] { locations[i] }
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
|
||||
{
|
||||
return new VSTHRD106AsyncEventHandlerAnalyzer();
|
||||
return new VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzer();
|
||||
}
|
||||
|
||||
[Fact]
|
|
@ -6,28 +6,28 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
public class VSTHRD200AsyncSuffixAnalyzerTests : CodeFixVerifier
|
||||
public class VSTHRD200UseAsyncNamingConventionAnalyzerTests : CodeFixVerifier
|
||||
{
|
||||
public VSTHRD200AsyncSuffixAnalyzerTests(ITestOutputHelper logger)
|
||||
public VSTHRD200UseAsyncNamingConventionAnalyzerTests(ITestOutputHelper logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
private DiagnosticResult NewExpectedTemplate() => new DiagnosticResult
|
||||
{
|
||||
Id = VSTHRD200AsyncSuffixAnalyzer.Id,
|
||||
Id = VSTHRD200UseAsyncNamingConventionAnalyzer.Id,
|
||||
SkipVerifyMessage = true,
|
||||
Severity = DiagnosticSeverity.Warning,
|
||||
};
|
||||
|
||||
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
|
||||
{
|
||||
return new VSTHRD200AsyncSuffixAnalyzer();
|
||||
return new VSTHRD200UseAsyncNamingConventionAnalyzer();
|
||||
}
|
||||
|
||||
protected override CodeFixProvider GetCSharpCodeFixProvider()
|
||||
{
|
||||
return new VSTHRD200AsyncSuffixCodeFix();
|
||||
return new VSTHRD200UseAsyncNamingConventionCodeFix();
|
||||
}
|
||||
|
||||
[Fact]
|
|
@ -39,33 +39,33 @@
|
|||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="VSTHRD106AsyncEventHandlerAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD200AsyncSuffixAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD200AsyncSuffixCodeFix.cs" />
|
||||
<Compile Include="VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD200UseAsyncNamingConventionAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD200UseAsyncNamingConventionCodeFix.cs" />
|
||||
<Compile Include="CommonInterest.cs" />
|
||||
<Compile Include="VSTHRD003JtfRunAwaitTaskAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD003UseJtfRunAsyncAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD102AvoidJtfRunInNonPublicMembersAnalyzer.cs" />
|
||||
<Compile Include="Namespaces.cs" />
|
||||
<Compile Include="VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzer.cs" />
|
||||
<Compile Include="Strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VSTHRD103UseAwaitInAsyncMethodsAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD103UseAsyncOptionAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD011LazyOfTaskAnalyzer.cs" />
|
||||
<Compile Include="Types.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="VSTHRD101AsyncVoidLambdaAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD100AsyncVoidMethodAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD100AsyncVoidMethodCodeFix.cs" />
|
||||
<Compile Include="VSTHRD002SynchronousWaitAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD103UseAwaitInAsyncMethodsCodeFix.cs" />
|
||||
<Compile Include="VSTHRD002UseJtfRunAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD103UseAsyncOptionCodeFix.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
<Compile Include="VSTHRD010VsServiceUsageAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD012SpecifyJtfWhereAllowed.cs" />
|
||||
<Compile Include="VSTHRD104OfferAsyncOptionAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD001AvoidLegacyThreadSwitchingAnalyzer.cs" />
|
||||
<Compile Include="VSTHRD001UseSwitchToMainThreadAsyncAnalyzer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config">
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
internal static bool HasAsyncAlternative(this IMethodSymbol methodSymbol, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return methodSymbol.ContainingType.GetMembers(methodSymbol.Name + VSTHRD200AsyncSuffixAnalyzer.MandatoryAsyncSuffix)
|
||||
return methodSymbol.ContainingType.GetMembers(methodSymbol.Name + VSTHRD200UseAsyncNamingConventionAnalyzer.MandatoryAsyncSuffix)
|
||||
.Any(alt => IsXAtLeastAsPublicAsY(alt, methodSymbol));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
using CodeAnalysis.Diagnostics;
|
||||
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD001AvoidLegacyThreadSwitchingAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD001UseSwitchToMainThreadAsyncAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD001";
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
/// task.Wait(); /* This analyzer will report warning on this synchronous wait. */
|
||||
/// </remarks>
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD002SynchronousWaitAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD002UseJtfRunAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD002";
|
||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
/// ]]>
|
||||
/// </remarks>
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD003JtfRunAwaitTaskAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD003UseJtfRunAsyncAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD003";
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
/// ]]>
|
||||
/// </remarks>
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD103UseAwaitInAsyncMethodsAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD103UseAsyncOptionAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD103";
|
||||
|
||||
|
@ -93,10 +93,10 @@
|
|||
SimpleNameSyntax invokedMethodName = memberAccessSyntax?.Name ?? invocationExpressionSyntax.Expression as IdentifierNameSyntax;
|
||||
var symbolInfo = context.SemanticModel.GetSymbolInfo(invocationExpressionSyntax, context.CancellationToken);
|
||||
var methodSymbol = symbolInfo.Symbol as IMethodSymbol;
|
||||
if (symbolInfo.Symbol != null && !symbolInfo.Symbol.Name.EndsWith(VSTHRD200AsyncSuffixAnalyzer.MandatoryAsyncSuffix) &&
|
||||
if (symbolInfo.Symbol != null && !symbolInfo.Symbol.Name.EndsWith(VSTHRD200UseAsyncNamingConventionAnalyzer.MandatoryAsyncSuffix) &&
|
||||
!(methodSymbol?.ReturnType?.Name == nameof(Task) && methodSymbol.ReturnType.BelongsToNamespace(Namespaces.SystemThreadingTasks)))
|
||||
{
|
||||
string asyncMethodName = symbolInfo.Symbol.Name + VSTHRD200AsyncSuffixAnalyzer.MandatoryAsyncSuffix;
|
||||
string asyncMethodName = symbolInfo.Symbol.Name + VSTHRD200UseAsyncNamingConventionAnalyzer.MandatoryAsyncSuffix;
|
||||
var asyncMethodMatches = context.SemanticModel.LookupSymbols(
|
||||
invocationExpressionSyntax.Expression.GetLocation().SourceSpan.Start,
|
||||
symbolInfo.Symbol.ContainingType,
|
||||
|
@ -106,7 +106,7 @@
|
|||
{
|
||||
// An async alternative exists.
|
||||
var properties = ImmutableDictionary<string, string>.Empty
|
||||
.Add(VSTHRD103UseAwaitInAsyncMethodsCodeFix.AsyncMethodKeyName, asyncMethodName);
|
||||
.Add(VSTHRD103UseAsyncOptionCodeFix.AsyncMethodKeyName, asyncMethodName);
|
||||
|
||||
Diagnostic diagnostic = Diagnostic.Create(
|
||||
Descriptor,
|
||||
|
@ -165,13 +165,13 @@
|
|||
messageArgs.Add(item.MethodName);
|
||||
if (item.AsyncAlternativeMethodName != null)
|
||||
{
|
||||
properties = properties.Add(VSTHRD103UseAwaitInAsyncMethodsCodeFix.AsyncMethodKeyName, item.AsyncAlternativeMethodName);
|
||||
properties = properties.Add(VSTHRD103UseAsyncOptionCodeFix.AsyncMethodKeyName, item.AsyncAlternativeMethodName);
|
||||
descriptor = Descriptor;
|
||||
messageArgs.Add(item.AsyncAlternativeMethodName);
|
||||
}
|
||||
else
|
||||
{
|
||||
properties = properties.Add(VSTHRD103UseAwaitInAsyncMethodsCodeFix.AsyncMethodKeyName, string.Empty);
|
||||
properties = properties.Add(VSTHRD103UseAsyncOptionCodeFix.AsyncMethodKeyName, string.Empty);
|
||||
descriptor = DescriptorNoAlternativeMethod;
|
||||
}
|
||||
|
|
@ -29,12 +29,12 @@
|
|||
/// ]]>
|
||||
/// </remarks>
|
||||
[ExportCodeFixProvider(LanguageNames.CSharp)]
|
||||
public class VSTHRD103UseAwaitInAsyncMethodsCodeFix : CodeFixProvider
|
||||
public class VSTHRD103UseAsyncOptionCodeFix : CodeFixProvider
|
||||
{
|
||||
internal const string AsyncMethodKeyName = "AsyncMethodName";
|
||||
|
||||
private static readonly ImmutableArray<string> ReusableFixableDiagnosticIds = ImmutableArray.Create(
|
||||
VSTHRD103UseAwaitInAsyncMethodsAnalyzer.Id);
|
||||
VSTHRD103UseAsyncOptionAnalyzer.Id);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override ImmutableArray<string> FixableDiagnosticIds => ReusableFixableDiagnosticIds;
|
||||
|
@ -76,7 +76,7 @@
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string EquivalenceKey => VSTHRD103UseAwaitInAsyncMethodsAnalyzer.Id;
|
||||
public override string EquivalenceKey => VSTHRD103UseAsyncOptionAnalyzer.Id;
|
||||
|
||||
private string AlternativeAsyncMethod => this.diagnostic.Properties[AsyncMethodKeyName];
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
/// <see cref="TaskScheduler.Current"/> itself).
|
||||
/// </remarks>
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD105AvoidImpliedTaskSchedulerCurrentAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD105AvoidImplicitTaskSchedulerCurrentAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD105";
|
||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
/// ]]>
|
||||
/// </remarks>
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD106AsyncEventHandlerAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD106UseInvokeAsyncForAsyncEventsAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD106";
|
||||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
using CodeAnalysis.Diagnostics;
|
||||
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public class VSTHRD200AsyncSuffixAnalyzer : DiagnosticAnalyzer
|
||||
public class VSTHRD200UseAsyncNamingConventionAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public const string Id = "VSTHRD200";
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
}
|
||||
|
||||
var properties = ImmutableDictionary<string, string>.Empty
|
||||
.Add(VSTHRD200AsyncSuffixCodeFix.NewNameKey, methodSymbol.Name + MandatoryAsyncSuffix);
|
||||
.Add(VSTHRD200UseAsyncNamingConventionCodeFix.NewNameKey, methodSymbol.Name + MandatoryAsyncSuffix);
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Descriptor,
|
||||
methodSymbol.Locations[0],
|
|
@ -22,12 +22,12 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
using CodeAnalysis.Rename;
|
||||
|
||||
[ExportCodeFixProvider(LanguageNames.CSharp)]
|
||||
public class VSTHRD200AsyncSuffixCodeFix : CodeFixProvider
|
||||
public class VSTHRD200UseAsyncNamingConventionCodeFix : CodeFixProvider
|
||||
{
|
||||
internal const string NewNameKey = "NewName";
|
||||
|
||||
private static readonly ImmutableArray<string> ReusableFixableDiagnosticIds = ImmutableArray.Create(
|
||||
VSTHRD200AsyncSuffixAnalyzer.Id);
|
||||
VSTHRD200UseAsyncNamingConventionAnalyzer.Id);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override ImmutableArray<string> FixableDiagnosticIds => ReusableFixableDiagnosticIds;
|
||||
|
@ -60,7 +60,7 @@ namespace Microsoft.VisualStudio.Threading.Analyzers
|
|||
this.NewName);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string EquivalenceKey => VSTHRD200AsyncSuffixAnalyzer.Id;
|
||||
public override string EquivalenceKey => VSTHRD200UseAsyncNamingConventionAnalyzer.Id;
|
||||
|
||||
private string NewName => this.diagnostic.Properties[NewNameKey];
|
||||
|
Загрузка…
Ссылка в новой задаче