-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Milestone
Description
Repro:
// IL2026 for type (ILLink produces this twice)
class ClassWithWarningOnGenericArgumentConstructor_NewAndAnnotation : RequiresNewAndConstructors<ClassWithRequires>
{
// IL2026 (ILLink produces this twice)
public ClassWithWarningOnGenericArgumentConstructor_NewAndAnnotation()
{
}
}
class RequiresNewAndConstructors<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] T> where T : new();
[RequiresUnreferencedCode("Message for --ClassWithRequires--")]
class ClassWithRequires;
This produces a warning on the type and on the implicit call to the base constructor (ILLink and ILC both do this). But ILLink produces two of each. That's because:
- ILC handles the new constraint by treating it like PublicParameterlessConstructor annotations
- ILLink handles the new constraint separately, while marking generic argument types
Metadata
Metadata
Assignees
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Type
Projects
Status
No status