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

Fix S4507 FP: Error raised on .NET 7 although the debug feature is deactivated #6772

Closed
VianneyDoleans opened this issue Feb 20, 2023 · 2 comments · Fixed by #8572
Closed
Assignees
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@VianneyDoleans
Copy link

Description

I migrate a project to .NET 7. The error S4507 is raised although the debug feature is desactivated in production mode.

Repro steps

Code inside program.cs :

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.UseExceptionHandler("/error");
if (app.Environment.IsDevelopment())
    app.UseDeveloperExceptionPage();
else
    app.UseHsts();

Link to the SonarCloud public project where the issue appears : link

Expected behavior

Code is already deactivated so it should not be highlighted

Actual behavior

The error S4507 is raised.

Related information

@VianneyDoleans VianneyDoleans changed the title Fix S4507 [FP]: Rrror raised on .NET 7 although the debug feature is desactivated Fix S4507 [FP]: Error raised on .NET 7 although the debug feature is desactivated Feb 20, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource changed the title Fix S4507 [FP]: Error raised on .NET 7 although the debug feature is desactivated Fix S4507 FP: Error raised on .NET 7 although the debug feature is desactivated Feb 21, 2023
@martin-strecker-sonarsource martin-strecker-sonarsource changed the title Fix S4507 FP: Error raised on .NET 7 although the debug feature is desactivated Fix S4507 FP: Error raised on .NET 7 although the debug feature is deactivated Feb 21, 2023
@martin-strecker-sonarsource
Copy link
Contributor

Thanks for the reporting and the detailed description @VianneyDoleans. I created a reproducer in #6777 on our side and confirm this being an FP.

@antonioaversa
Copy link
Contributor

antonioaversa commented Jan 31, 2024

@zsolt-kolbay-sonarsource We are releasing 9.19 for SQ 10.4, and this issue is not going to make it into the release.
I am removing the Sprint: Hardening label to close the sprint, but I am leaving it on the board since its review is in progress and we may get it to a mergeable state in the coming days.

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added this to the 9.21 milestone Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants