Closed j-r-morton closed 9 months ago
I've looked into this and have got a minimal repo (below). Interestingly, this only happens when you inherit from a base class and call its constructor (with a paremeter), i.e it's triggered by the BaseClass(property)
in the example below.
public class Test(int property) : BaseClass(property)
{
public void MethodOne()
{
var one = string.Empty;
var two = string.Empty;
var three = string.Empty;
var four = string.Empty;
var five = string.Empty;
var six = string.Empty;
}
public void MethodTwo()
{
var one = string.Empty;
var two = string.Empty;
var three = string.Empty;
var four = string.Empty;
var five = string.Empty;
}
}
public class BaseClass
{
protected BaseClass(int property)
{
}
}
This issue is fixed in v1.7.0
of Audacia.CodeAnalysis
Adding a primary constructor to a class seems to make the compiler think it's a big method instead of a class:
It would be preferable if this warning was supressed on class definitions. (note: this may now also start showing the more than X arguments warning, which also would be nice if disabled against a class? I think a similar idea was raised against primary constructors on records).