Skip to content

ILLink: Trim analyzer doesn't warn on dataflow through multidimensional array #101951

@jtschuster

Description

@jtschuster

Analyzer will not warn that an element of a multidimensional array does not satisfy DAM constraints.

ArrayDataFlow.cs: 

// Multidimensional Arrays not handled -- assumed to be UnknownValue
[UnexpectedWarning ("IL2062", nameof (DataFlowTypeExtensions.RequiresPublicMethods), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2062", nameof (DataFlowTypeExtensions.RequiresAll), Tool.Trimmer | Tool.NativeAot, "")]
static void TestArrayWithInitializerOneElementStaticType ()
{
	Type[,] arr = new Type[,] { { typeof (TestType) } };
	arr[0, 0].RequiresAll ();
	arr[0, 1].RequiresPublicMethods (); // Should warn - unknown value at this index
}

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions