Skip to content

ILLink analyzer analysis holes around dynamic objects #94057

@sbomer

Description

@sbomer

The analyzer has basic handling of IDynamicInvocationOperation, but not IDynamicMemberInvocation and related operation types. This support should be added and moved from the attribute-based analyzer into the dataflow analyzer.

For example, this produces no analyzer warnings:

static void Test(dynamic d) {
    d.Member = 1;
}

but ILLink produces a warning:

Trim analysis warning IL2026: Program.<<Main>$>g__Test|0_0(Object): Using member 'Microsoft.CSharp.RuntimeBinder.Binder.SetMember(CSharpBinderFlags, String, Type, IEnumerable<CSharpArgumentInfo>)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Using dynamic types might cause types or members to be removed by trimmer.

Discovered in #94016.

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions