UnmanagedType.ByValArray byte[] in Struct won't Compile in x64

Viewed 436

Current struct:

    [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
    private struct SubStruct
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        [FieldOffset(0)]
        public byte[] Array;
        [FieldOffset(8)] public MockEnum MockEnum;
    }

This struct simply existing in my Unit Test project prevents resharper from running it under x64 settings. I just get the "Inconclusive, Test wasn't run" error.

Compiling in x86 works fine, and if I comment out the byte array and its two attributes, I can compile in x64 no problem.

So for some reason something about [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] isn't getting along with x64?

Running it in VS2015, C#6.0, .Net 4.6.2, Resharper 2017.1.3

Update: Works fine on this setup: VS2017, C#7.0, .net 4.5.2, Resharper 2017.1.3

Must be a .net problem or visual studio 2015 problem?

0 Answers
Related