Skip to content

Marshal.GetNativeVariantForObject throws ComException for various objects #26820

@hughbe

Description

@hughbe

No failures with msbuild /T:BuildAndTest /P:TargetGroup=netfx

But with msbuild /T:BuildAndTest /P:TargetGroup=netcoreapp

  xUnit.net console test runner (64-bit .NET Core)
  Copyright (C) 2014 Outercurve Foundation.

  Discovering: System.Runtime.InteropServices.Tests
  Discovered:  System.Runtime.InteropServices.Tests
  Starting:    System.Runtime.InteropServices.Tests
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariantForObject_RoundtrippingPrimiti
  ves_Success(primitive: [00:00:00.0000010], expectedVarType: 8228, expectedValue: -1) [FAIL]
        System.Runtime.InteropServices.COMException : Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(194,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.GetNativeVariantForObject_ValidObject_Success(Object primitive, VarEnum expectedVarType, IntPtr expectedValue,
   Object expectedRoundtripValue)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(87,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObject
  Tests.GetNativeVariantForObject_RoundtrippingPrimitives_Success(Object primitive, VarEnum expectedVarType, IntPtr exp
  ectedValue)
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariantForObject_RoundtrippingPrimiti
  ves_Success(primitive: System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests+StructWithValue, expectedV
  arType: VT_RECORD, expectedValue: -1) [FAIL]
        System.Runtime.InteropServices.COMException : Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(194,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.GetNativeVariantForObject_ValidObject_Success(Object primitive, VarEnum expectedVarType, IntPtr expectedValue,
   Object expectedRoundtripValue)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(87,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObject
  Tests.GetNativeVariantForObject_RoundtrippingPrimitives_Success(Object primitive, VarEnum expectedVarType, IntPtr exp
  ectedValue)
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariantForObject_RoundtrippingPrimiti
  ves_Success(primitive: [System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests+StructWithValue, null], e
  xpectedVarType: 8204, expectedValue: -1) [FAIL]
        System.Runtime.InteropServices.COMException : Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(194,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.GetNativeVariantForObject_ValidObject_Success(Object primitive, VarEnum expectedVarType, IntPtr expectedValue,
   Object expectedRoundtripValue)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(87,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObject
  Tests.GetNativeVariantForObject_RoundtrippingPrimitives_Success(Object primitive, VarEnum expectedVarType, IntPtr exp
  ectedValue)
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariant_NotInteropCompatible_ThrowsAr
  gumentException(obj: [System.Runtime.InteropServices.Tests.Common.GenericStruct`1[System.String]]) [FAIL]
        Assert.Throws() Failure
        Expected: typeof(System.ArgumentException)
        Actual:   typeof(System.Runtime.InteropServices.COMException): Unspecified error (Exception from HRESULT: 0x800
  04005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(343,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.<>c__DisplayClass21_0.<GetNativeVariant_NotInteropCompatible_ThrowsArgumentException>b__0()
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariant_NotInteropCompatible_ThrowsAr
  gumentException(obj: []) [FAIL]
        Assert.Throws() Failure
        Expected: typeof(System.ArgumentException)
        Actual:   typeof(System.Runtime.InteropServices.COMException): Unspecified error (Exception from HRESULT: 0x800
  04005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(343,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.<>c__DisplayClass21_0.<GetNativeVariant_NotInteropCompatible_ThrowsArgumentException>b__0()
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariant_NotInteropCompatible_ThrowsAr
  gumentException(obj: [System.Runtime.InteropServices.Tests.Common.GenericStruct`1[System.String]]) [FAIL]
        Assert.Throws() Failure
        Expected: typeof(System.ArgumentException)
        Actual:   typeof(System.Runtime.InteropServices.COMException): Unspecified error (Exception from HRESULT: 0x800
  04005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(343,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.<>c__DisplayClass21_0.<GetNativeVariant_NotInteropCompatible_ThrowsArgumentException>b__0()
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariant_NotInteropCompatible_ThrowsAr
  gumentException(obj: []) [FAIL]
        Assert.Throws() Failure
        Expected: typeof(System.ArgumentException)
        Actual:   typeof(System.Runtime.InteropServices.COMException): Unspecified error (Exception from HRESULT: 0x800
  04005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(343,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.<>c__DisplayClass21_0.<GetNativeVariant_NotInteropCompatible_ThrowsArgumentException>b__0()
     System.Runtime.InteropServices.Tests.GetNativeVariantForObjectTests.GetNativeVariant_NotInteropCompatible_ThrowsAr
  gumentException(obj: [Color [A=0, R=0, G=0, B=10]]) [FAIL]
        Assert.Throws() Failure
        Expected: typeof(System.ArgumentException)
        Actual:   typeof(System.Runtime.InteropServices.COMException): Unspecified error (Exception from HRESULT: 0x800
  04005 (E_FAIL))
        Stack Trace:
              at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
           C:\Users\hughb\Documents\GitHub\corefx\src\System.Runtime.InteropServices\tests\System\Runtime\InteropServic
  es\Marshal\GetNativeVariantForObjectTests.cs(343,0): at System.Runtime.InteropServices.Tests.GetNativeVariantForObjec
  tTests.<>c__DisplayClass21_0.<GetNativeVariant_NotInteropCompatible_ThrowsArgumentException>b__0()
  Finished:    System.Runtime.InteropServices.Tests

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions