Skip to content

Comments

Ensure GetFirstRelatedDocumentId doesn't return non-source documents#81893

Merged
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:fix-additional-file-breaking-tree-sharing
Jan 8, 2026
Merged

Ensure GetFirstRelatedDocumentId doesn't return non-source documents#81893
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:fix-additional-file-breaking-tree-sharing

Conversation

@jasonmalinowski
Copy link
Member

The expectation of our "related" document helpers seems to be they only operate on regular documents. If we didn't do this, and we have a regular source file also being added as an additional file somewhere, callers of this method get surprised.

Fixes https://developercommunity.visualstudio.com/t/Constant-Feature-X-is-currently-unava/11023066

@jasonmalinowski jasonmalinowski self-assigned this Jan 6, 2026
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner January 6, 2026 23:37
The expectation of our "related" document helpers seems to be they
only operate on regular documents. If we didn't do this, and we have a
regular source file also being added as an additional file somewhere,
callers of this method get surprised.

Fixes https://developercommunity.visualstudio.com/t/Constant-Feature-X-is-currently-unava/11023066
@jasonmalinowski jasonmalinowski force-pushed the fix-additional-file-breaking-tree-sharing branch from ea43ed8 to abb6bf7 Compare January 8, 2026 06:16
@jasonmalinowski jasonmalinowski merged commit a291525 into dotnet:main Jan 8, 2026
26 checks passed
@jasonmalinowski jasonmalinowski deleted the fix-additional-file-breaking-tree-sharing branch January 8, 2026 18:27
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Started backporting to release/dev18.3 (link to workflow run)

jasonmalinowski added a commit that referenced this pull request Jan 9, 2026
…-source documents (#81923)

Backport of #81893 to release/dev18.3

/cc @jasonmalinowski

## Customer Impact

If the user adds a .cs file to one of their projects as additional
files, we may break when we try to unify syntax trees for them, since
the additional files don't actually have syntax trees.

## Regression

Unclear; this might have been an older regression when we introduced
this mechanism. The customer who reported it said itw as a regression
but since they had made a lot of changes to their code around that time
that would have exposed it.

## Testing

Unit tests were added. They were validated to produce the same exception
as is being reported from the customer.

## Risk

Low.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants