prodot / ReCommended-Extension

Code analysis improvements and context actions
Apache License 2.0
59 stars 11 forks source link

BUG: Fix for "redundant await" adds duplicate [NotNull] attribute #57

Closed RichardD2 closed 2 years ago

RichardD2 commented 2 years ago

Starting with the following code:

[NotNull]
public async Task Foo()
{
    return await Task.Delay(100);
}

The extension flags up three issues:

Applying the quick fix for the "redundant 'await'" issue results in the following code:

[NotNull, NotNull]
public Task Foo()
{
    return Task.Delay(100);
}

This is a compiler error: CS0579 Duplicate NotNull attribute.

The quick-fix should check whether the method is already decorated with the [NotNull] attribute before adding it again.

michael-damatov commented 2 years ago

The bug has been fixed with the Release 5.7.0. You can download the updated package immediately to install it manually or wait (a couple of business days) for JetBrains making it available in the Extension Manager.