dotnet / dotnet/roslyn

Adding or removing a resx resource key in Balanced mode sometimes fails to trigger a rerun of a source generator

Open
#85,158 0 comments 0 reactions 0 assignees View on GitHub
Area-IDE Feature - Source Generators
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: Visual Studio 18.9.2

**Steps to Reproduce**:

1. Ensure that the Source Generator config in C# Advanced is set to **Balanced** (should be the default)
2. Create a small incremental source generator that extracts the keys from resx files and creates an enum
3. Add the SG as reference to a sample project to consume
4. Adding or removing a resource key with the integrated resx manager or the xml-editor triggers a rerun of the generator, but doing the same with [ResXResourceManager](https://github.com/dotnet/ResXResourceManager) does not.

You can find my test repo here https://github.com/Garzuuhl/ResxPlayground

**Expected Behavior**:
Adding or removing a resource key should trigger the source generation on save, whether it's done through ResXResourceManager or the integrated resx manager

**Actual Behavior**:
Source generation is run when using the integrated resx manager but not ResXResourceManager

**Note**:
Setting the C# Advanced Source Generator config to "Automatic" does work and causes changes through ResXResourceManager to also trigger a rerun of the source generator

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the linked ResxPlayground test repository, using Balanced mode and comparing edits made through ResXResourceManager with the integrated resx manager or XML editor. Trace the source-generator rerun triggered on save and identify why the external editor's resource-key changes are missed. Done means adding or removing a key through ResXResourceManager reliably reruns generation in Balanced mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.