roslynator
roslynator copied to clipboard
RCS0053 - does some strange formatting
Product and Version Used: NuGet package - 4.12.4
Steps to Reproduce: Enable the rule
Example 1
Actual Behavior:
private static readonly FrozenSet<string?> SomeThing =
SomeFunction
.Concat(
[
// some comment
null,
])
.ToFrozenSet();
Expected Behavior:
private static readonly FrozenSet<string?> SomeThing =
SomeFunction
.Concat(
[
// some comment
null,
])
.ToFrozenSet();
Example 2
Actual Behavior:
return new DefaultAzureCredential(new DefaultAzureCredentialOptions
{
ManagedIdentityClientId = clientId,
ExcludeWorkloadIdentityCredential = true,
Diagnostics =
{
IsAccountIdentifierLoggingEnabled = diagnosticsEnabled,
IsDistributedTracingEnabled = diagnosticsEnabled,
IsLoggingEnabled = diagnosticsEnabled
}
});
Expected Behavior:
return new DefaultAzureCredential(new DefaultAzureCredentialOptions
{
ManagedIdentityClientId = clientId,
ExcludeWorkloadIdentityCredential = true,
Diagnostics =
{
IsAccountIdentifierLoggingEnabled = diagnosticsEnabled,
IsDistributedTracingEnabled = diagnosticsEnabled,
IsLoggingEnabled = diagnosticsEnabled
}
});
Issue:
So, what is wrong with the above?
- In example 1 open and end brackets have different indentations
- It adds an extra indentation level when one is not needed (see the outer layer in example 2). This conflicts with the default formatter in VS as well.
- If
dotnet format
is run more than once, it seems to indentDiagnostics
in example 2 more than once.