Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

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

Closed

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 (); }
}

Activity

  1. jtschuster commented on Jan 6, 2022

    @jtschuster
    MemberAuthor

    My mistake, I forgot to reference the class somewhere and it got trimmed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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