Skip to content

Incorrect IL2026 for [RequiresUnreferencedCode] on type deriving from A<B> where B has new() in A<T> definition #108507

@Sergio0694

Description

@Sergio0694

Description

Spotted what seems to be an incorrect trim warning that's not suppressed correctly.

Reproduction Steps

[RequiresUnreferencedCode("")]
class A;

class B<T> where T : new();

[RequiresUnreferencedCode("")]
class C : B<A>;

Expected behavior

No warnings.

Actual behavior

image

Regression?

No, can repro on .NET 8 as well.

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions