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.

RUC analyzer doesn't handle attribute .ctors #2094

Closed

Description

@vitek-karas
class AttributeWithRUC : Attribute
{
    [RequiresUnreferencedCode ("")]
    public AttributeWithRUC() {}
}

// Should produce IL2026
[AttributeWithRUC]
static void MethodWithAttributeWithRUC() {}

// Should not produce any warning since the IL2026 from the attribute should be suppressed by the RUC
[RequiresUnreferencedCode("")]
[AttributeWithRUC]
static void RUCMethodWithAttributeWithRUC() {}

Analyzer doesn't seem to handle attribute instantiations as calls to the attribute .ctor. So if the attribute .ctor has RUC on it, it will not generate a warning.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions