Skip to content

Conversation

chsienki
Copy link
Member

@chsienki chsienki commented Jun 26, 2025

Adds a simple heuristic so we don't load the razor redirector unless it could plausibly be a razor assembly.

This will give false positives, but that's fine. The actual razor redirector knows the specific assemblies to redirect.

All the razor assemblies have 'razor' in their name and live in a directory with 'razor' in their name, so we should never have false negatives from this.

@chsienki chsienki requested a review from a team as a code owner June 26, 2025 18:03
public string? RedirectPath(string fullPath)
{
// Simple heuristic so we don't load razor unnecessarily.
if (fullPath.IndexOf("razor", StringComparison.OrdinalIgnoreCase) >= 0)
Copy link
Member

@phil-allen-msft phil-allen-msft Jun 26, 2025

Choose a reason for hiding this comment

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

Should you check for cshtml here as well?

If it's the path of a file in the loaded project, seems like 'yes'. If it's the path to a source generator, seems like 'no'.

Copy link
Member Author

Choose a reason for hiding this comment

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

Path to source generator and related assemblies.

@chsienki chsienki enabled auto-merge (squash) June 26, 2025 21:21
@chsienki chsienki merged commit 3e08fc9 into dotnet:main Jun 26, 2025
24 of 25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 26, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
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.

5 participants