Skip to content

Linker doesn't emit IL2026 (Warn on calls to a method with RUC) for constructors #2484

@jtschuster

Description

@jtschuster

The linker doesn't warn when a method annotated with RUC is called within a constructor. Tests for this issue are dependent on a fix for issue #2446 (ExpectedWarnings not recognized on constructors).

Example:

class WarningsInCtor
{
	[RequiresUnreferencedCode ("Message for WarningsInCtor.MethodWithRUC")]
	static void MethodWithRUC () { }

	//Bug: Should be produced by trimmer as well
	[ExpectedWarning ("IL2026", "Message for WarningsInCtor.MethodWithRUC", ProducedBy = ProducedBy.Analyzer)]
	public WarningsInCtor () { MethodWithRUC (); }

	//Bug: Should be produced by trimmer as well
	[ExpectedWarning ("IL2026", "Message for WarningsInCtor.MethodWithRUC", ProducedBy = ProducedBy.Analyzer)]
	static WarningsInCtor () { MethodWithRUC (); }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions