Product and Version Used: Roslynator.Analyzers 4.5.0, dotnet 7
Steps to Reproduce:
Consider that configuration is roslynator_object_creation_type_style = implicit_when_type_is_obvious.
In the following code:
// SomeType can be simply `public record SomeType;`
public record MyRecord(SomeType? Whatever = null)
{
public SomeType Whatever { get; init; } = Whatever ?? new();
}
The new() gives RCS1250: Use explicit object creation. The example below behaves as expected, wihout raising the problem:
public record MyRecord
{
public SomeType Whatever { get; init; } = new();
}
Actual Behavior: It raises the error in a situation where the type is obvious (considering that in my second example the new is considered obvious, the first is basically the same situation)
Expected Behavior: Not raising RCS1250 in my first example
Product and Version Used: Roslynator.Analyzers 4.5.0, dotnet 7
Steps to Reproduce:
Consider that configuration is
roslynator_object_creation_type_style = implicit_when_type_is_obvious.In the following code:
The
new()gives RCS1250: Use explicit object creation. The example below behaves as expected, wihout raising the problem:Actual Behavior: It raises the error in a situation where the type is obvious (considering that in my second example the new is considered obvious, the first is basically the same situation)
Expected Behavior: Not raising RCS1250 in my first example