roslyn-analyzers
roslyn-analyzers copied to clipboard
Analyzer ignores Inheritance
I tested the analyzer and realized that it does ignore inheritance. Given the following Code
public class Base
{
public int A { get; set; }
}
public class Child : Base
{
public int B { get; set; }
}
public class Programm {
public static void Main()
{
//AssignAll enable
var x = new Child
{
};
var y = new Child
{
B = 2
};
}
}
I would have expected that y also throws an error. But at the moment only x will complain about missing members.
Ah, yep, I didn't test that. My usecase was simple mappings between entity types and DTO types. I'm sure it's solvable though, but as I've mentioned before I'm not actively maintaining this project and won't pursue this myself. I'd be happy to assist and merging pull requests though!
Stumbled on this myself today, might just have the incentive to implement a fix.
Should be fixed in 1.6.0, please give it a try.