Skip to content

Commit

Permalink
Fix a build break when using new GenApi (#5269)
Browse files Browse the repository at this point in the history
- 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 1faec9a
  • Loading branch information
dougbu authored Apr 16, 2020
1 parent 79c7dc8 commit 11d46d2
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 11d46d2

Please sign in to comment.