Skip to content

Commit 163d64e

Browse files
committed
Fix RS0034 warning
1 parent 8abe1f7 commit 163d64e

8 files changed

Lines changed: 48 additions & 0 deletions

System.IO.Abstractions.Analyzers/CodeFixes/DirectoryCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ namespace System.IO.Abstractions.Analyzers.CodeFixes;
88
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(DirectoryCodeFix))]
99
public class DirectoryCodeFix : BaseInvokeCodeFix
1010
{
11+
[ImportingConstructor]
12+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
13+
public DirectoryCodeFix()
14+
{
15+
}
16+
1117
protected override string DiagnosticId => Constants.Io0003;
1218

1319
protected override string Title => "Use IFileSystem.Directory for improved testability";

System.IO.Abstractions.Analyzers/CodeFixes/DirectoryInfoCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public class DirectoryInfoCodeFix : CodeFixProvider
1616
{
1717
private const string Title = "Use IDirectoryInfoFactory instead creation DirectoryInfo for improved testability";
1818

19+
[ImportingConstructor]
20+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
21+
public DirectoryInfoCodeFix()
22+
{
23+
}
24+
1925
public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(Constants.Io0007);
2026

2127
public override sealed FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

System.IO.Abstractions.Analyzers/CodeFixes/FileCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ namespace System.IO.Abstractions.Analyzers.CodeFixes;
88
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(FileCodeFix))]
99
public class FileCodeFix : BaseInvokeCodeFix
1010
{
11+
[ImportingConstructor]
12+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
13+
public FileCodeFix()
14+
{
15+
}
16+
1117
protected override string DiagnosticId => Constants.Io0002;
1218

1319
protected override string Title => "Use IFileSystem.File for improved testability";

System.IO.Abstractions.Analyzers/CodeFixes/FileInfoCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public class FileInfoCodeFix : CodeFixProvider
1616
{
1717
private const string Title = "Use IFileInfoFactory instead creation FileInfo for improved testability";
1818

19+
[ImportingConstructor]
20+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
21+
public FileInfoCodeFix()
22+
{
23+
}
24+
1925
public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(Constants.Io0004);
2026

2127
public override sealed FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

System.IO.Abstractions.Analyzers/CodeFixes/FileServiceConstructorInitialCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public class FileServiceConstructorInitialCodeFix : CodeFixProvider
1515
{
1616
private const string Title = "Create FileSystem in constructor and using System.IO.Abstractions";
1717

18+
[ImportingConstructor]
19+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
20+
public FileServiceConstructorInitialCodeFix()
21+
{
22+
}
23+
1824
public override sealed ImmutableArray<string> FixableDiagnosticIds =>
1925
ImmutableArray.Create(Constants.Io0002,
2026
Constants.Io0003,

System.IO.Abstractions.Analyzers/CodeFixes/FileServiceInterfaceInjectionCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public class FileServiceInterfaceInjectionCodeFix : CodeFixProvider
1515
{
1616
private const string Title = "Inject IFileSystem and using System.IO.Abstractions";
1717

18+
[ImportingConstructor]
19+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
20+
public FileServiceInterfaceInjectionCodeFix()
21+
{
22+
}
23+
1824
public override sealed ImmutableArray<string> FixableDiagnosticIds =>
1925
ImmutableArray.Create(Constants.Io0002,
2026
Constants.Io0003,

System.IO.Abstractions.Analyzers/CodeFixes/FileStreamCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public class FileStreamCodeFix : CodeFixProvider
1616
{
1717
private const string Title = "Use IFileStreamFactory instead creation FileStream for improved testability";
1818

19+
[ImportingConstructor]
20+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
21+
public FileStreamCodeFix()
22+
{
23+
}
24+
1925
public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(Constants.Io0005);
2026

2127
public override sealed FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

System.IO.Abstractions.Analyzers/CodeFixes/PathCodeFix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ namespace System.IO.Abstractions.Analyzers.CodeFixes;
88
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(PathCodeFix))]
99
public class PathCodeFix : BaseInvokeCodeFix
1010
{
11+
[ImportingConstructor]
12+
[Obsolete("This exported object must be obtained through the MEF export provider.", true)]
13+
public PathCodeFix()
14+
{
15+
}
16+
1117
protected override string DiagnosticId => Constants.Io0006;
1218

1319
protected override string Title => "Use IFileSystem.Path for improved testability";

0 commit comments

Comments
 (0)