.NET SDK10 Roslyn Analyzer Diagnostics `IDE0130` likely buggy

bic 25 Reputation points
2026-08-06T06:43:22.4066667+00:00

Description

IDE0130 makes sure declared C# namespace matches the corresponding folder structure.

Issue

IDE0130 seems to work as expected in most cases. However, when a partial implementation with a corresponding generated source is analyzed, the analyzer seems to completely skip it.

Expected Behavior?

I would expect non-generated sources to still be analyzed and violations to be reported, regardless of generated sources. Neither partial nor the fact a generated source is involved should override this analysis in my opinion.

Question

And here is my question I guess.. What is the reasoning behind this behavior? Did I miss something?

Developer technologies | .NET | Other

Answer accepted by question author

Danny Nguyen (WICLOUD CORPORATION) 8,015 Reputation points Microsoft External Staff Moderator
2026-08-06T07:25:00.98+00:00

Hi @bic ,

Thank you for reporting this. I was able to reproduce this behavior locally. It appears to be a known limitation of the analyzer's current design rather than a bug.

The IDE0130 analyzer skips checking partial classes if they are spread across multiple files. This is because the automatic "fixer" tool (which runs when you try to automatically fix the warning in your editor) does not currently support fixing partial classes with multiple parts.

Because the tool cannot safely fix the warning for a partial class spread across a normal .cs file and a generated .g.cs file, it chooses to skip checking the rule completely to avoid showing a warning that it cannot automatically solve.

There is an open issue on the dotnet/roslyn repository tracking this exact limitation. A Microsoft team member confirmed this is currently the intended behavior, but they are open to fixing it based on community feedback.

You can view the issue here: IDE0130 does not report on partial classes (#72749).

I suggest upvoting that issue and leaving a brief comment about your experience with generated files. This helps the team understand how this limitation affects developers and may help prioritize a fix.

If this answers your question, I would greatly appreciate it if you could follow this guidance or provide feedback.

Thank you.

Was this answer helpful?

3 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.