Skip to content

fix(csharp): stop tuple-typed properties losing their name to the method branch - #1967

Open
AmirF194 wants to merge 2 commits into
oraios:mainfrom
AmirF194:fix/csharp-tuple-property-name-corruption
Open

fix(csharp): stop tuple-typed properties losing their name to the method branch#1967
AmirF194 wants to merge 2 commits into
oraios:mainfrom
AmirF194:fix/csharp-tuple-property-name-corruption

Conversation

@AmirF194

@AmirF194 AmirF194 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • This PR follows the guidelines in CONTRIBUTING.md regarding the scope of PRs.
  • For changes that add features or fix problems, I have added an entry to CHANGELOG.md, which concisely describes the change.

_extract_base_name_and_type splits Roslyn's "Name : Type" property names by checking for ( anywhere in the raw string. A C# tuple type is written with parens, e.g. (int X, string Y), so a tuple-typed property tripped that check and fell into the method branch instead, keeping the trailing " :" in the reported name ("Position :" instead of "Position"). Since find_symbol defaults to exact name matching, such a property becomes unfindable by its real name.

Narrowed the ( check to the segment before the first " : ", so a parenthesis inside the type no longer affects branch selection. Checked it doesn't regress a method that returns a tuple or takes tuple-typed parameters, both of which still have ( before that segment.

Added TestCSharpExtractBaseNameAndType. The new test fails without the change ("Position :") and passes with it. poe lint and codespell are clean. I didn't capture a live Roslyn trace for the tuple case specifically, the expected "Name : Type" format is the same pattern the existing tests already confirm live for non-tuple properties, plus standard C# tuple syntax, so this rests on that plus the language spec rather than an observed wire capture.

…hod branch

_extract_base_name_and_type split Roslyn's "Name : Type" property names by
checking for a literal '(' anywhere in the raw string. A C# tuple type is
written with parentheses ("(int X, string Y)"), so a tuple-typed property
tripped that guard and fell into the method branch instead, which kept the
trailing " :" as part of the reported name (e.g. "Position :"). Since
find_symbol defaults to exact name-path matching, such a property becomes
unfindable by its real name.

The guard now only checks for '(' in the identifier segment before the
first " : ", not the whole string, so a parenthesis inside the type
annotation no longer affects branch selection.
@AmirF194
AmirF194 force-pushed the fix/csharp-tuple-property-name-corruption branch from 12eda18 to 37feb03 Compare September 3, 2026 13:26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the modified method _extract_base_name_and_type is called by _normalize_symbol_name, the change must invalidate the high-level symbol cache by incrementing this version. See docstring of _normalize_symbol_name in base class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, missed that this changes what the cache stores. Bumped normalize_symbol_name_version to 2 in _document_symbols_cache_fingerprint, pushed as 8f2406d.

_normalize_symbol_name's output changed in this PR, and
_document_symbols_cache_fingerprint gates the cache that stores its
result; leaving the version at 1 would keep serving the old, corrupted
names to anyone with an existing on-disk cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants