public static void StructWithDefaultNonBlittableFields_Bool_MarshalAsInfo() { short s = 41; bool b = true; Assert.True(DisabledRuntimeMarshallingNative.CheckStructWithShortAndBool(new StructWithShortAndBoolWithMarshalAs(s, b), s, b)); }
public static void StructWithDefaultNonBlittableFields_Bool() { short s = 42; bool b = true; // By default, bool is a 4-byte Windows BOOL, which will cause us to incorrectly marshal back the struct from native code. Assert.False(DisabledRuntimeMarshallingNative.CheckStructWithShortAndBool(new StructWithShortAndBool(s, b), s, b)); }
public static void EntryPoint_With_StructWithDefaultNonBlittableFields_NotFound() { short s = 42; bool b = true; // By default, bool is a 4-byte Windows BOOL, which will make the calculation of stack space for the stdcall calling convention // incorrect, causing the entry point to not be found. Assert.Throws <EntryPointNotFoundException>(() => DisabledRuntimeMarshallingNative.CheckStructWithShortAndBool(new StructWithShortAndBool(s, b), s, b)); }
public static void StructWithDefaultNonBlittableFields_MarshalAsInfo() { short s = 41; bool b = true; Assert.True(DisabledRuntimeMarshallingNative.CheckStructWithShortAndBool(new StructWithShortAndBoolWithMarshalAs(s, b), s, b)); // We use a the "green check mark" character so that we use both bytes and // have a value that can't be accidentally round-tripped. char c = '✅'; Assert.True(DisabledRuntimeMarshallingNative.CheckStructWithWCharAndShort(new StructWithWCharAndShortWithMarshalAs(s, c), s, c)); }