Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<Compile Include="$(MSBuildThisFileDirectory)FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\CSharpFormattingCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GenerateConstructor\GenerateConstructorDiagnosticIds.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseCodeFixProvider.AddNewKeywordAction.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\CSharpImplementAbstractClassCodeFixProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@
namespace Microsoft.CodeAnalysis.CSharp.GenerateDefaultConstructors;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.GenerateDefaultConstructors), Shared]
internal class CSharpGenerateDefaultConstructorsCodeFixProvider : AbstractGenerateDefaultConstructorCodeFixProvider
[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
internal sealed class CSharpGenerateDefaultConstructorsCodeFixProvider()
: AbstractGenerateDefaultConstructorCodeFixProvider
{
private const string CS1729 = nameof(CS1729); // 'B' does not contain a constructor that takes 0 arguments CSharpConsoleApp3 C:\Users\cyrusn\source\repos\CSharpConsoleApp3\CSharpConsoleApp3\Program.cs 1 Active
private const string CS7036 = nameof(CS7036); // There is no argument given that corresponds to the required parameter 's' of 'B.B(string)'
private const string CS8983 = nameof(CS8983); // CS8983: A 'struct' with field initializers must include an explicitly declared constructor.

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpGenerateDefaultConstructorsCodeFixProvider()
{
}

public override ImmutableArray<string> FixableDiagnosticIds { get; } =
[CS1729, CS7036, CS8983];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@
namespace Microsoft.CodeAnalysis.CSharp.GenerateDefaultConstructors;

[ExportLanguageService(typeof(IGenerateDefaultConstructorsService), LanguageNames.CSharp), Shared]
internal class CSharpGenerateDefaultConstructorsService : AbstractGenerateDefaultConstructorsService<CSharpGenerateDefaultConstructorsService>
[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
internal sealed class CSharpGenerateDefaultConstructorsService() : AbstractGenerateDefaultConstructorsService<CSharpGenerateDefaultConstructorsService>
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpGenerateDefaultConstructorsService()
{
}

protected override bool TryInitializeState(
SemanticDocument semanticDocument, TextSpan textSpan, CancellationToken cancellationToken,
[NotNullWhen(true)] out INamedTypeSymbol? classType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<Compile Include="$(MSBuildThisFileDirectory)FixReturnType\FixReturnTypeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ForEachCast\ForEachCastTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\FormattingAnalyzerTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GenerateDefaultConstructors\GenerateDefaultConstructorsTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests_FixAllTests.cs" />
Expand Down
Loading