dotnet / dotnet/roslyn

IDE0060 flags partial methods used by source generators

Open
#75,700 9 comments 4 reactions 0 assignees View on GitHub
Area-IDE Feature - IDE0060
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

I have been using the Riok.Mapperly library and during development everything is fine.

However when running 'dotnet format --verify-no-changes' on the repository in GitHub Actions (or on my PC) the errors appear and the code quality check fails.

I am using 'dotnet format --verify-no-changes --exclude-diagnostics IDE0060' for now but it's not very elegant.

Commands like 'dotnet build' seem to be okay.

Some user-written code:

```csharp
[Mapper]
public static partial class DeviceMapper
{
[MapProperty("Name.Value", "Name")]
public static partial DeviceDto MapDeviceToDeviceDto(Device d);
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the IDE0060 diagnostic with the shown C# partial method, comparing `dotnet build` with `dotnet format --verify-no-changes`. Trace how the IDE0060 analyzer handles partial methods used by source generators; done means the valid generated-method case no longer makes format verification fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.