Open Sergio0694 opened 3 weeks ago
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas See info in area-owners.md if you want to be subscribed.
Related: https://github.com/dotnet/runtime/issues/108523
There are two problems here:
C
A
's ctor, not C
.An additional problem we might want to solve as part of this:
class C : B<A>
{
public C()
{
}
}
In this case the analyzer misses the warning due to the implicit call to the base constructor. Note that the following example does produce a wartning:
[RequiresUnreferencedCode]
class Requires {}
class Derived : Requires
{
public Derived // warning IL2026
{
}
}
The logic for checking the new constraint should be moved into the analyzer's dataflow logic where the implicit base constructor call is visible.
Description
Spotted what seems to be an incorrect trim warning that's not suppressed correctly.
Reproduction Steps
Expected behavior
No warnings.
Actual behavior
Regression?
No, can repro on .NET 8 as well.