summaryrefslogtreecommitdiff
path: root/src/vm/fieldmarshaler.cpp
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>2019-04-04 22:56:56 -0700
committerGitHub <noreply@github.com>2019-04-04 22:56:56 -0700
commit8241971dc93dca98992596a9396dee1a2031ea15 (patch)
treeac75247a13082544183134f946ecd185d00a4dd2 /src/vm/fieldmarshaler.cpp
parent3a058450784d6ceb2ca8fd4b7b1ca8d3d6d4e8a9 (diff)
downloadcoreclr-8241971dc93dca98992596a9396dee1a2031ea15.tar.gz
coreclr-8241971dc93dca98992596a9396dee1a2031ea15.tar.bz2
coreclr-8241971dc93dca98992596a9396dee1a2031ea15.zip
Disable marshalling delegates as _Delegate and enable marshalling delegates as IDispatch. (#23738)
* Disable marshalling delegates as _Delegate and enable marshalling delegates as IDispatch. * ifdef out the new IDispatch marshalling on non-COM-supporting platforms. * PR feedback.
Diffstat (limited to 'src/vm/fieldmarshaler.cpp')
-rw-r--r--src/vm/fieldmarshaler.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vm/fieldmarshaler.cpp b/src/vm/fieldmarshaler.cpp
index 51d9b8b798..a8676d65bd 100644
--- a/src/vm/fieldmarshaler.cpp
+++ b/src/vm/fieldmarshaler.cpp
@@ -588,12 +588,16 @@ do \
{
INITFIELDMARSHALER(NFT_ILLEGAL, FieldMarshaler_Illegal, (IDS_EE_BADMARSHAL_WINRT_ILLEGAL_TYPE));
}
+ else if (COMDelegate::IsDelegate(thNestedType.GetMethodTable()))
+ {
+ INITFIELDMARSHALER(NFT_ILLEGAL, FieldMarshaler_Illegal, (IDS_EE_BADMARSHAL_DELEGATE_TLB_INTERFACE));
+ }
else
{
ItfMarshalInfo itfInfo;
if (FAILED(MarshalInfo::TryGetItfMarshalInfo(thNestedType, FALSE, FALSE, &itfInfo)))
break;
-
+
INITFIELDMARSHALER(NFT_INTERFACE, FieldMarshaler_Interface, (itfInfo.thClass.GetMethodTable(), itfInfo.thItf.GetMethodTable(), itfInfo.dwFlags));
}
}
@@ -792,6 +796,16 @@ do \
{
INITFIELDMARSHALER(NFT_DELEGATE, FieldMarshaler_Delegate, (thNestedType.GetMethodTable()));
}
+#ifdef FEATURE_COMINTEROP
+ else if (ntype == NATIVE_TYPE_IDISPATCH)
+ {
+ ItfMarshalInfo itfInfo;
+ if (FAILED(MarshalInfo::TryGetItfMarshalInfo(thNestedType, FALSE, FALSE, &itfInfo)))
+ break;
+
+ INITFIELDMARSHALER(NFT_INTERFACE, FieldMarshaler_Interface, (itfInfo.thClass.GetMethodTable(), itfInfo.thItf.GetMethodTable(), itfInfo.dwFlags));
+ }
+#endif // FEATURE_COMINTEROP
else
{
INITFIELDMARSHALER(NFT_ILLEGAL, FieldMarshaler_Illegal, (IDS_EE_BADMARSHAL_DELEGATE));