dotnet / dotnet/roslyn

"Make method synchronous" fix should not be provided for an interface implementing method

Open
#79,342 3 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**:
Latest public VS preview

**Steps to Reproduce**:
```cs
public class MyClass : I, IAsyncDisposable
{
public async ValueTask DisposeAsync()
{
}

public async Task M()
{
}
}

public interface I
{
Task M();
}
```
Try applying "Make method synchronous" fix for `DisposeAsync` and `M`

**Expected Behavior**:
This fix shouldn't even be in the list. You can prbably argue that we can also change an interface method if it comes from a source interface, but that leads to invalidation of all other use sites, so I don't think that should be an option

**Actual Behavior**:
Applying the fix makes the code uncompilable:
```cs
public class MyClass : I, IAsyncDisposable
{
public ValueTask Dispose()
{
}

public void M()
{
}
}

public interface I
{
Task M();
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.