Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs replaced with spaces in the generated razor file #9050

Closed
csaba-sagi-sonarsource opened this issue Jul 28, 2023 · 0 comments · Fixed by #9247
Closed

Tabs replaced with spaces in the generated razor file #9050

csaba-sagi-sonarsource opened this issue Jul 28, 2023 · 0 comments · Fixed by #9247
Assignees
Labels
area-compiler Umbrella for all compiler issues
Milestone

Comments

@csaba-sagi-sonarsource
Copy link

Steps to reproduce:

  1. Clone MudBlazor.
  2. Enable emitting the generated files by setting <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
  3. Build the solution

When razor generates the code behind for line 3 of SectionHeader.razor, which contains a tab, it replaces the tab with four spaces.
Meaning the generated code will look like this:

#line 3 "C:\Projects\MudBlazor\src\MudBlazor.Docs\Components\SectionHeader.razor"
     if (!String.IsNullOrWhiteSpace(Title) && HideTitle == false)  // This line contains 5 spaces prefix instead of 1 tab
    {  // This line has the tab preserved

This is an issue since if one wants to do code analysis for the file and calls GetMappedLineSpan, it will not correctly map the location back to the razor file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-compiler Umbrella for all compiler issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants