diff --git a/src/ILCompiler/src/Program.cs b/src/ILCompiler/src/Program.cs index 2a871002d56..d5ba90f9168 100644 --- a/src/ILCompiler/src/Program.cs +++ b/src/ILCompiler/src/Program.cs @@ -496,7 +496,7 @@ private int Run(string[] args) ? new FrameworkStringResourceBlockingPolicy() : (ManifestResourceBlockingPolicy)new NoManifestResourceBlockingPolicy(); - metadataGenerationOptions = UsageBasedMetadataGenerationOptions.AnonymousTypeHeuristic; + metadataGenerationOptions |= UsageBasedMetadataGenerationOptions.AnonymousTypeHeuristic; if (_completeTypesMetadata) metadataGenerationOptions |= UsageBasedMetadataGenerationOptions.CompleteTypesOnly; if (_scanReflection) diff --git a/tests/src/Simple/PInvoke/PInvoke.cs b/tests/src/Simple/PInvoke/PInvoke.cs index cbb3470f4e5..09de4ef5a44 100644 --- a/tests/src/Simple/PInvoke/PInvoke.cs +++ b/tests/src/Simple/PInvoke/PInvoke.cs @@ -746,6 +746,12 @@ public class NonBlittableClass public int f3; } + [StructLayout(LayoutKind.Sequential)] + public class ClassForTestingFlowAnalysis + { + public int Field; + } + private static void TestStruct() { Console.WriteLine("Testing Structs"); @@ -983,6 +989,9 @@ private static void TestMarshalStructAPIs() { Marshal.FreeHGlobal(nbc_memory); } + + int cftf_size = Marshal.SizeOf(typeof(ClassForTestingFlowAnalysis)); + ThrowIfNotEquals(4, cftf_size, "ClassForTestingFlowAnalysis marshalling Marshal API failed"); } }