-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-System.Runtime.InteropServicesdisabled-testThe test is disabled in source code against the issueThe test is disabled in source code against the issuetenet-compatibilityIncompatibility with previous versions or .NET FrameworkIncompatibility with previous versions or .NET Framework
Milestone
Description
From dotnet/corefx#31461
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
[ActiveIssue()]
public void GetObjectForNativeVariant_Record_ReturnsExpected()
{
int record = 10;
var recordInfo = new RecordInfo { Guid = typeof(int).GUID };
IntPtr pRecord = Marshal.AllocHGlobal(Marshal.SizeOf<int>());
IntPtr pRecordInfo = Marshal.GetComInterfaceForObject<RecordInfo, IRecordInfo>(recordInfo);
try
{
Marshal.StructureToPtr(record, pRecord, fDeleteOld: false);
Variant variant = CreateVariant(VT_RECORD, new UnionTypes
{
_record = new Record
{
_record = pRecord,
_recordInfo = pRecordInfo
}
});
Assert.Equal(10, GetObjectForNativeVariant(variant));
GetObjectForNativeVariant_NestedVariant_ReturnsExpected(variant, record);
variant.m_Variant.vt |= VT_BYREF;
Assert.Equal(10, GetObjectForNativeVariant(variant));
}
finally
{
Marshal.DestroyStructure<int>(pRecord);
Marshal.FreeHGlobal(pRecord);
Marshal.Release(pRecordInfo);
}
}This passes with netfx
On netcoreapp:
Discovering: System.Runtime.InteropServices.Tests
Discovered: System.Runtime.InteropServices.Tests
Starting: System.Runtime.InteropServices.Tests
System.Runtime.InteropServices.Tests.GetObjectForNativeVariantTests.GetObjectForNativeVariant_Record_ReturnsExpect
ed [FAIL]
System.ArgumentException : The specified record cannot be mapped to a managed value class.
Stack Trace:
at System.Runtime.InteropServices.Marshal.GetObjectForNativeVariant(IntPtr pSrcNativeVariant)
C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
es\Marshal\GetObjectForNativeVariantTests.cs(1027,0): at System.Runtime.InteropServices.Tests.GetObjectForNativeVaria
ntTests.GetObjectForNativeVariant(Variant variant)
C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
es\Marshal\GetObjectForNativeVariantTests.cs(700,0): at System.Runtime.InteropServices.Tests.GetObjectForNativeVarian
tTests.GetObjectForNativeVariant_Record_ReturnsExpected()
Finished: System.Runtime.InteropServices.Tests
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Runtime.InteropServicesdisabled-testThe test is disabled in source code against the issueThe test is disabled in source code against the issuetenet-compatibilityIncompatibility with previous versions or .NET FrameworkIncompatibility with previous versions or .NET Framework