Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUC should suppress warnings about generics from type #108523

Open
Tracked by #101149
sbomer opened this issue Nov 29, 2022 · 5 comments
Open
Tracked by #101149

RUC should suppress warnings about generics from type #108523

sbomer opened this issue Nov 29, 2022 · 5 comments
Labels
area-NativeAOT-coreclr area-Tools-ILLink .NET linker development as well as trimming analyzers
Milestone

Comments

@sbomer
Copy link
Member

sbomer commented Nov 29, 2022

RUC on type silences warnings for code in members of the type, including generics warnings for methods.
But it doesn't silence warnings about generics on the type itself:

    class RequireAll<[DAM(DAMT.All)] T> {}
    
    [RUC("C<T>")]
    class C<T> : RequireAll<T> {} // IL2091 'T' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.All' 

I believe RUC on type should silence this warning. I can't think of a way to do something unsafe with typeof(C<>) that wouldn't cause warnings elsewhere.

@sbomer
Copy link
Member Author

sbomer commented Dec 1, 2022

Similar for fields:

    class G<[DAM(DAMT.PublicMethods)] T> {}

    [RUC("")]
    class CInst<T> {
        public static G<T> field; // IL2091

        public G<T> instField; // IL2091
    }

    [RequiresUnreferencedCode("")]
    public static void Test() {
        var f = new CInst<int>().instField;
        var g = CInst<int>.field;
    }

I think these cases should not warn.

Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr area-Tools-ILLink .NET linker development as well as trimming analyzers
Projects
Status: No status
Development

No branches or pull requests

1 participant