dotnet / dotnet/roslyn

Microsoft.CodeAnalysis.PublicApiAnalyzers RS0016 code fix should respect project's NRT setting.

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

Description

**Version Used**: Microsoft.CodeAnalysis.PublicApiAnalyzers v4.14.0

**Steps to Reproduce**:

1. Add the analyzer to a new project
2. Apply the code fix

**Diagnostic Id**:

RS0016

**Expected Behavior**:

The code fix for RS0016 should add `#nullable enable` to newly created PublicAPI.*.txt files.

**Actual Behavior**:

If there is no existing PublicAPI.*.txt file, the code fix for RS0016 creates a new one which does not include `#nullable enable`, causing RS0037 warnings. Adding `#nullable enable` manually afterwards will give RS0036 warnings because the code fix for RS0016 did not include nullable annotations.

Contributor guide

Open the contributing guide

Research direction

Locate the RS0016 code-fix implementation and the logic that creates new PublicAPI.*.txt files. Check how the project's nullable reference types setting is determined, then verify that a newly created file handles nullable annotations consistently and no longer produces the reported RS0037 or RS0036 warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.