Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 11c3eb3

Browse files
Ad #316: Error when running Search for issues with Automatically Fix enabled.
Add SupportsAutoFix (default = false) property to prevent issues from trying to 'fix' code which cannot be fixed without user interaction.
1 parent 514266d commit 11c3eb3

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SearchForIssuesCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ IEnumerable<SearchResultMatch> FindAndFixIssues(FileName fileName, List<IssueMan
226226
cancellationToken.ThrowIfCancellationRequested();
227227
var issues = provider.GetIssues(context).ToList();
228228
// Fix issues, if possible:
229-
if (issues.Any(i => i.Actions.Count > 0)) {
229+
if (provider.Attribute.SupportsAutoFix && issues.Any(i => i.Actions.Count > 0)) {
230230
using (var script = context.StartScript()) {
231231
foreach (var issue in issues) {
232232
if (issue.Actions.Count > 0) {

src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/IssueAttribute.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class IssueDescriptionAttribute : System.Attribute
4141
public string SuppressMessageCheckId { get; set; }
4242
public int PragmaWarning { get; set; }
4343
public bool IsEnabledByDefault { get; set; }
44+
public bool SupportsAutoFix { get; set; }
4445

4546
public Severity Severity { get; set; }
4647

0 commit comments

Comments
 (0)