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.

ExpectedWarning doesn't check for warnings on constructors #2446

Closed

Description

@jtschuster

ExpectedWarning attribute will not check for warnings when on a static constructor. For example, the following test will pass:
RequiresCapability.cs:

class ClassWithConstructors
{
	[ExpectedWarning ("WarningThatNeverComes", "LoremIpsum")]
	static ClassWithConstructors()
	{
	}

	[ExpectedWarning("NoWarningWillCome", "asdfjkl;")]
	public ClassWithConstructors() { }
}

Activity

  1. changed the title [-]ExpectedWarning doesn't check for warnings on static constructors[/-] [+]ExpectedWarning doesn't check for warnings on constructors[/+] on Dec 15, 2021
  2. jtschuster commented on Dec 15, 2021

    @jtschuster
    MemberAuthor

    It looks like this only happens in the analyzer tests.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions