Skip to content

Audit reflection usage in our assemblies #4708

Description

@radekdoulik

The ILlink is now doing reflection analysis resulting in reported warnings. Context: https://github.com/mono/linker/blob/master/docs/design/reflection-flow.md

We should audit our reflection usage by checking the reported warnings and look into how to solve these. (by updating the code where needed or suppressing the warnings)

Example output:

...
                     ILlinker : Unrecognized reflection pattern warning IL2006: Reflection call 'System.Type System.Type::GetType(System.String,System.Func`2<System.Reflection.AssemblyName,System.Reflection.Assembly>,System.Func`4<System.Reflection.Assembly,System.String,System.Boolean,System.Type>,System.Boolean,System.Boolean,System.Threading.StackCrawlMark&)' inside 'System.Type System.Type::GetType(System.String,System.Func`2<System.Reflection.AssemblyName,System.Reflection.Assembly>,System.Func`4<System.Reflection.Assembly,System.String,System.Boolean,System.Type>,System.Boolean)' was detected with unknown value for the type name. [/Users/runner/runners/2.168.2/work/1/s/bin/TestRelease/temp/DotNetBuildandroid.21-armTrue/UnnamedProject.csproj]
                     ILlinker : Unrecognized reflection pattern warning IL2006: The parameter 'nullableType' of method 'System.Void System.Linq.Expressions.Compiler.ILGen::EmitGetValue(System.Reflection.Emit.ILGenerator,System.Type)' with dynamically accessed member kinds 'None' is passed into the parameter '' of method 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Reflection.BindingFlags)' which requires dynamically accessed member kinds 'PublicMethods'. To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'PublicMethods'. [/Users/runner/runners/2.168.2/work/1/s/bin/TestRelease/temp/DotNetBuildandroid.21-armTrue/UnnamedProject.csproj]

    115 Warning(s)
    0 Error(s)

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions