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

Third party issues on Razor templates are not imported #8737

Open
andrei-epure-sonarsource opened this issue Feb 11, 2024 · 2 comments
Open
Labels
Type: Web Improve ASP.NET, Razor, Blazor or similar rules.

Comments

@andrei-epure-sonarsource
Copy link
Contributor

We analyze Razor templates (.razor, .cshtml files) and we should import third party issues.

Repro streps

  1. Clone https://github.com/dotnet/blazor-samples
  2. Scan /blazor-samples/7.0/BlazorServerEFCoreSample in verbose mode
cd blazor-samples\7.0\BlazorServerEFCoreSample
dotnet sonarscanner begin /k:"demo" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="sqa_TOKEN" /d:sonar.verbose=true
dotnet build .\BlazorServerEFCoreSample.csproj
dotnet sonarscanner end /d:sonar.login="sqa_TOKEN"

The build logs show:

blazor-samples\7.0\BlazorServerEFCoreSample\Shared\ContactRow.razor(50,20): warning BL0007: Component parameter 'BlazorServerEFCoreSample.Shared.ContactRow.CurrentContact' should be auto property [C:\con ferences\2024_blazor_webinar\blazor-samples\7.0\BlazorServerEFCoreSample\BlazorServerEFCoreSample.csproj]
blazor-samples\7.0\BlazorServerEFCoreSample\Pages\Index.razor(98,16): warning BL0007: Component parameter 'BlazorServerEFCoreSample.Pages.Index.Page' should be auto property [C:\conferences\2024_blazor_w ebinar\blazor-samples\7.0\BlazorServerEFCoreSample\BlazorServerEFCoreSample.csproj]

And the debug logs show:

20:21:11.882 DEBUG: Failed to retrieve the real full path for 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_ContactRow_razor.g.cs'
20:21:11.883 DEBUG: Skipping issue BL0007, input file not found or excluded: Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_ContactRow_razor.g.cs
20:21:11.883 DEBUG: Failed to retrieve the real full path for 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_Index_razor.g.cs'
20:21:11.884 DEBUG: Skipping issue BL0007, input file not found or excluded: Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_Index_razor.g.cs

Expected: BL0007 is imported as third party issue.
Actual: no third party issues are imported on Razor templates.

Dotnet version: 8.0.200-preview.23624.5 (ok, maybe I should install the LTS released version)
Analyzer version: 9.19
SonarScanner for MSBuild 5.15

@andrei-epure-sonarsource
Copy link
Contributor Author

Probably related to dotnet/roslyn#51773

@costin-zaharia-sonarsource
Copy link
Member

costin-zaharia-sonarsource commented Feb 12, 2024

The paths are not indexed so the issues cannot be imported. This should be fixed by dotnet/roslyn#71449

@costin-zaharia-sonarsource costin-zaharia-sonarsource added Type: Web Improve ASP.NET, Razor, Blazor or similar rules. and removed Type: New Feature labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Web Improve ASP.NET, Razor, Blazor or similar rules.
Projects
None yet
Development

No branches or pull requests

2 participants