Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Restore fully qualify for Razor - #80674

#80674
Merged
davidwengier merged 1 commit into
dotnet:maindotnet/roslyn:mainfrom
davidwengier:FixRazorFullyQualifydavidwengier/roslyn:FixRazorFullyQualifyCopy head branch name to clipboard
Oct 13, 2025
Merged

Restore fully qualify for Razor#80674
davidwengier merged 1 commit into
dotnet:maindotnet/roslyn:mainfrom
davidwengier:FixRazorFullyQualifydavidwengier/roslyn:FixRazorFullyQualifyCopy head branch name to clipboard

Conversation

@davidwengier

@davidwengier davidwengier commented Oct 13, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.