Thanks to visit codestin.com
Credit goes to github.com

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
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ private void AnalyzeNode(SymbolAnalysisContext context, CommonInterest.Awaitable
return;
}

// Skip the method of the recommended dispose pattern.
if (methodSymbol.Name == "DisposeAsyncCore")
{
return;
}

bool hasAsyncFocusedReturnType = Utils.HasAsyncCompatibleReturnType(methodSymbol);

bool actuallyEndsWithAsync = methodSymbol.Name.EndsWith(MandatoryAsyncSuffix, StringComparison.CurrentCulture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,29 @@ public async Task TaskReturningPropertyWithoutSuffix_GeneratesNoWarning()
class Test {
Task Foo => null;
}
";
await CSVerify.VerifyAnalyzerAsync(test);
}

[Fact]
public async Task MethodDisposeAsyncCore_GeneratesNoWarning()
{
var test = @"
using System;
using System.Threading.Tasks;

class Test : IAsyncDisposable
{
public async ValueTask DisposeAsync()
{
await DisposeAsyncCore().ConfigureAwait(false);
GC.SuppressFinalize(this);
}

protected virtual async ValueTask DisposeAsyncCore()
{
}
}
";
await CSVerify.VerifyAnalyzerAsync(test);
}
Expand Down