The following class is a valid class based on the attached editorconfig.txt
using Microsoft.AspNetCore.Mvc;
namespace Web.Controllers;
[Route("test")]
public class TestController : ControllerBase
{
private readonly ILogger<TestController> logger;
public TestController(ILogger<TestController> logger)
{
this.logger = logger;
}
[HttpPost("test/{id}")]
public ActionResult Test(string id)
{
this.logger.LogInformation("Hello {Id}", id);
return this.Ok("Format me");
}
}
When I run dotnet dotnet-format the file is formatted as follows:
After some time digging into the problem I realized that changing the primary constructor to a regular constructor fixes the issue. And dotnet-format will not format wrongly the file.
dotnet dotnet-format
the file is formatted as follows:dotnet-format
will not format wrongly the file.