Skip to content

RequiresDynamicCode analyzer should understand RuntimeFeature.IsDynamicCodeSupported #2715

@MichalStrehovsky

Description

@MichalStrehovsky

Even though M1 below calls a method annotated RequiresDynamicCode, it does so in a code path that is not reachable at runtime when dynamic code is not supported. We should not generate a warning.

static void M1()
{
    if (RuntimeFeature.IsDynamicCodeSupported)
    {
        M2();
    }
}

[RequiresDynamicCode("...")]
static void M2()
{
}

Cc @tlakollo

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
No status

Relationships

None yet

Development

No branches or pull requests

Issue actions