Fix build break in CoreRT/ProjectN
authorJan Kotas <jkotas@microsoft.com>
Fri, 31 Aug 2018 04:06:51 +0000 (21:06 -0700)
committerJan Kotas <jkotas@microsoft.com>
Fri, 31 Aug 2018 18:09:07 +0000 (11:09 -0700)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/9ed18951643bc05060b377bf006f2530cb857bdb

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

index 1013112..1f8c0b0 100644 (file)
@@ -1785,7 +1785,12 @@ namespace System.Diagnostics.Tracing
                     if (dataType.IsEnum())
                     {
                         dataType = Enum.GetUnderlyingType(dataType);
-                        if (Runtime.InteropServices.Marshal.SizeOf(dataType) < sizeof(int))
+#if ES_BUILD_PN
+                        int dataTypeSize = (int)dataType.TypeHandle.ToEETypePtr().ValueTypeSize;
+#else
+                        int dataTypeSize = System.Runtime.InteropServices.Marshal.SizeOf(dataType);
+#endif
+                        if (dataTypeSize < sizeof(int))
                             dataType = typeof(int);
                         goto Again;
                     }