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>
src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs

index 10131124f2e8c20d8fd57aa9817c13574183a214..1f8c0b06a5a646fe69e85b02ffc5a0ebc3874a43 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;
                     }