dotnet / dotnet/roslyn

Exception in RESX generator: duplicate file name

Open Beginner friendly
#80,813 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Analyzers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

While trying to implement an incremental source generator the "right" way, I found the tip at https://github.com/dotnet/roslyn/discussions/60272#discussioncomment-6053422 to make hint file names unique.

However, the referenced code contains a bug. When only the casing differs, an exception is still thrown.

The line at https://github.com/dotnet/roslyn/blob/bb57f4643bb3d52eb7626f9863da177d9e219f1e/src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator/AbstractResxGenerator.cs#L151 should be changed to:

var names = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

/cc @sharwell

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at line 151 of src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator/AbstractResxGenerator.cs, as linked in the issue. Update the name handling so file names differing only by casing no longer cause an exception; done means the RESX generator accepts those names without the duplicate-file-name failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.