You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Special casing System.Guid for COM VARIANT marshalling (#100377)
* Support System.Guid marshalling via VARIANT
VARIANT marshalling in .NET 5+ requires a TLB
for COM records (i.e., ValueType instances). This
means that without a runtime provided TLB, users
must define their own TLB for runtime types or
define their own transfer types.
We address this here by deferring to the NetFX
mscorlib's TLB.
Co-authored-by: Elinor Fung <elfung@microsoft.com>
Copy file name to clipboardexpand all lines: src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshalling/ComVariant.cs
+5-1
Original file line number
Diff line number
Diff line change
@@ -404,7 +404,11 @@ public static unsafe ComVariant CreateRaw<T>(VarEnum vt, T rawValue)
404
404
(VarEnum.VT_UNKNOWN or VarEnum.VT_DISPATCH or VarEnum.VT_LPSTR or VarEnum.VT_BSTR or VarEnum.VT_LPWSTR or VarEnum.VT_SAFEARRAY
405
405
or VarEnum.VT_CLSID or VarEnum.VT_STREAM or VarEnum.VT_STREAMED_OBJECT or VarEnum.VT_STORAGE or VarEnum.VT_STORED_OBJECT or VarEnum.VT_CF or VT_VERSIONED_STREAM, _)whensizeof(T)==nint.Size=>rawValue,
406
406
(VarEnum.VT_CY or VarEnum.VT_FILETIME,8)=>rawValue,
Copy file name to clipboardexpand all lines: src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetNativeVariantForObjectTests.cs
+34
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,40 @@ public void GetNativeVariantForObject_String_Success(string obj)
Copy file name to clipboardexpand all lines: src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetObjectForNativeVariantTests.cs
+25-1
Original file line number
Diff line number
Diff line change
@@ -246,14 +246,38 @@ public void GetObjectForNativeVariant_InvalidDate_ThrowsArgumentException(double
0 commit comments