I see it’s already been rised and fixed according to that link S4261 // Methods should be named according to their synchronicities should not apply to controllers
But I still see such issue reported for Controllers.
I’m using SonarCloud and our projects uses .NET 4.8 and .NET 8.
ganncamp
(G Ann Campbell)
June 18, 2025, 12:20pm
2
Hi,
That’s a very old thread. A lot has changed since then and it’s likely you’re facing a different false positive than that thread was about.
Can you provide a reproducer, i.e. a self-contained code snippet that demonstrates the false-positive?
Thx,
Ann
Hi, thanks for reply.
Here is an example from our codebase
ganncamp
(G Ann Campbell)
June 18, 2025, 2:23pm
5
Hi,
Screenshots are hard.
Would you mind copy/pasting the text so we can copy/paste it locally to reproduce?
Thx,
Ann
Sorry
Here is a code
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Results;
namespace Example
{
public class MicroServicesHealthCheckController : ApiController
{
public MicroServicesHealthCheckController()
{
}
[HttpGet]
public async Task<StatusCodeResult> HealthCheck(string microServiceName)
{
return StatusCode(System.Net.HttpStatusCode.OK);
}
}
}
1 Like
ganncamp
(G Ann Campbell)
June 18, 2025, 3:15pm
7
Hi,
Thanks for that. I’m going to flag this for the language experts.
Ann
1 Like
Hello @bartlomiejmucha ,
I was not able to reproduce the error locally.
For me, the issue is not raising as expected for actions in controllers.
Could you provide me with a small reproducer in a form of a csproj project?
Thank you,
1 Like