Skip to content

Restore fully qualify for Razor#80674

Merged
davidwengier merged 1 commit intodotnet:mainfrom
davidwengier:FixRazorFullyQualify
Oct 13, 2025
Merged

Restore fully qualify for Razor#80674
davidwengier merged 1 commit intodotnet:mainfrom
davidwengier:FixRazorFullyQualify

Conversation

@davidwengier
Copy link
Member

@davidwengier davidwengier commented Oct 13, 2025

Fixes dotnet/razor#12315

#80649 disabled Fully Qualify for source generated documents because it was crashing for users. In actual fact the crash was already fixed in #77587:

// Including source generated documents as this service is used in Razor scenarios.
var document = await solution.GetRequiredDocumentAsync(documentId, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);

It still probably makes sense to not run the code action on normal source generated documents. Razor documents are not normal.

if (document.Id.IsSourceGenerated)
// possible, and we don't need to make pointless calls to oop to compute things. The exception is Razor
// which uses generated documents, but does its own mapping of changes back to the original source.
if (document.Id.IsSourceGenerated && !document.IsRazorSourceGeneratedDocument())
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to have a test for this? (perhaps in teh razor codebase?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we have unit and integration tests in Razor for this. The former isn't very helpful, because we don't automatically consume new versions of Roslyn, but we'd find out eventually I guess. Integration tests would show have caught this as soon as Roslyn merged to main (assuming they weren't on the floor, and seemingly trying to burrow their way down, but thats temporary I hope!)

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.

Improve/Fix "Add Using" and "Fully Qualify" code actions

2 participants