From c4c873f232bc84264ca4ef0e49e1beb5c9780ce2 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Wed, 15 Apr 2020 17:01:58 -0700 Subject: [PATCH] Fix a build break when using new GenApi - example failure in https://dev.azure.com/dnceng/internal/_build/results?buildId=601199 - undo a small part of #4585) - restore generation of `[StructLayout]` attributes on most value types - original commit was https://github.com/dotnet/arcade/pull/4585/commits/1faec9a821cf767d349c7ff18c544876be28cf2d --- .../Writers/CSharp/CSDeclarationWriter.Types.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.Cci.Extensions/Writers/CSharp/CSDeclarationWriter.Types.cs b/src/Microsoft.Cci.Extensions/Writers/CSharp/CSDeclarationWriter.Types.cs index b21bd2d92d1..b3afa997c15 100644 --- a/src/Microsoft.Cci.Extensions/Writers/CSharp/CSDeclarationWriter.Types.cs +++ b/src/Microsoft.Cci.Extensions/Writers/CSharp/CSDeclarationWriter.Types.cs @@ -25,8 +25,7 @@ public void WriteTypeDeclaration(ITypeDefinition type) // But we need also consider if this attribute is filtered out or not but I guess // we have the same problem with all the fake attributes at this point. - if (type.IsClass && type.Layout != LayoutKind.Auto || - type.IsStruct && (type.Layout != LayoutKind.Sequential || type.Alignment != 0 || type.SizeOf != 0 || type.StringFormat != StringFormatKind.Ansi)) + if ((type.IsStruct || type.IsClass) && type.Layout != LayoutKind.Auto) { FakeCustomAttribute structLayout = new FakeCustomAttribute("System.Runtime.InteropServices", "StructLayoutAttribute"); string layoutKind = string.Format("System.Runtime.InteropServices.LayoutKind.{0}", type.Layout.ToString());