summaryrefslogtreecommitdiff
path: root/src/vm/comcallablewrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/comcallablewrapper.cpp')
-rw-r--r--src/vm/comcallablewrapper.cpp100
1 files changed, 33 insertions, 67 deletions
diff --git a/src/vm/comcallablewrapper.cpp b/src/vm/comcallablewrapper.cpp
index 17f0fb60aa..540c708f16 100644
--- a/src/vm/comcallablewrapper.cpp
+++ b/src/vm/comcallablewrapper.cpp
@@ -16,9 +16,6 @@
#include "clrtypes.h"
#include "comcallablewrapper.h"
-#ifdef FEATURE_REMOTING
-#include "remoting.h"
-#endif
#include "object.h"
#include "field.h"
@@ -409,17 +406,6 @@ MethodTable* RefineProxy(OBJECTREF pServer)
MethodTable* pRefinedClass = NULL;
-#ifdef FEATURE_REMOTING
- GCPROTECT_BEGIN(pServer);
- if (pServer->IsTransparentProxy())
- {
- // if we have a transparent proxy let us refine it fully
- // before giving it out to unmanaged code
- REFLECTCLASSBASEREF refClass= CRemotingServices::GetClass(pServer);
- pRefinedClass = refClass->GetType().GetMethodTable();
- }
- GCPROTECT_END();
-#endif
RETURN pRefinedClass;
}
@@ -959,43 +945,43 @@ void SimpleComCallWrapper::BuildRefCountLogMessage(LPCWSTR wszOperation, StackSS
}
CONTRACTL_END;
- GCX_COOP();
-
- // There's no way how to get the class name if the AD is unloaded. We will just skip it if it
- // is the case. Note that we do log the AD unload event in SimpleComCallWrapper::Neuter so there
- // should still be enough useful information in the log.
- AppDomainFromIDHolder ad(GetRawDomainID(), TRUE);
- if (!ad.IsUnloaded())
- {
- LPCUTF8 pszClassName;
- LPCUTF8 pszNamespace;
- if (SUCCEEDED(m_pMT->GetMDImport()->GetNameOfTypeDef(m_pMT->GetCl(), &pszClassName, &pszNamespace)))
+ // Don't worry about domain unloading in CoreCLR
+ LPCUTF8 pszClassName;
+ LPCUTF8 pszNamespace;
+ if (SUCCEEDED(m_pMT->GetMDImport()->GetNameOfTypeDef(m_pMT->GetCl(), &pszClassName, &pszNamespace)))
+ {
+ OBJECTHANDLE handle = GetMainWrapper()->GetRawObjectHandle();
+ _UNCHECKED_OBJECTREF obj = NULL;
+
+ // Force retriving the handle without using OBJECTREF and under cooperative mode
+ // We only need the value in ETW events and it doesn't matter if it is super accurate
+ if (handle != NULL)
+ obj = *((_UNCHECKED_OBJECTREF *)(handle));
+
+ if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, CCWRefCountChange))
+ FireEtwCCWRefCountChange(
+ handle,
+ (Object *)obj,
+ this,
+ dwEstimatedRefCount,
+ NULL, // domain value is not interesting in CoreCLR
+ pszClassName, pszNamespace, wszOperation, GetClrInstanceId());
+
+ if (g_pConfig->ShouldLogCCWRefCountChange(pszClassName, pszNamespace))
{
- OBJECTHANDLE handle = GetMainWrapper()->GetRawObjectHandle();
- Object* obj = NULL;
- if (handle != NULL)
- obj = OBJECTREFToObject(ObjectFromHandle(handle));
-
- if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, CCWRefCountChange))
- FireEtwCCWRefCountChange(handle, obj, this, dwEstimatedRefCount, (LONGLONG) ad.GetAddress(),
- pszClassName, pszNamespace, wszOperation, GetClrInstanceId());
-
- if (g_pConfig->ShouldLogCCWRefCountChange(pszClassName, pszNamespace))
+ EX_TRY
{
- EX_TRY
- {
- StackSString ssClassName;
- TypeString::AppendType(ssClassName, TypeHandle(m_pMT));
+ StackSString ssClassName;
+ TypeString::AppendType(ssClassName, TypeHandle(m_pMT));
- ssMessage.Printf(W("LogCCWRefCountChange[%s]: '%s', Object=poi(%p)"),
- wszOperation, // %s operation
- ssClassName.GetUnicode(), // %s type name
- handle); // %p Object
- }
- EX_CATCH
- { }
- EX_END_CATCH(SwallowAllExceptions);
+ ssMessage.Printf(W("LogCCWRefCountChange[%s]: '%s', Object=poi(%p)"),
+ wszOperation, // %s operation
+ ssClassName.GetUnicode(), // %s type name
+ handle); // %p Object
}
+ EX_CATCH
+ { }
+ EX_END_CATCH(SwallowAllExceptions);
}
}
}
@@ -1286,10 +1272,6 @@ void SimpleComCallWrapper::InitNew(OBJECTREF oref, ComCallWrapperCache *pWrapper
MethodTable* pMT = pTemplate->GetClassType().GetMethodTable();
PREFIX_ASSUME(pMT != NULL);
-#ifdef FEATURE_REMOTING
- if (CRemotingServices::IsTransparentProxy(OBJECTREFToObject(oref)))
- m_flags |= enum_IsObjectTP;
-#endif
m_pMT = pMT;
m_pWrap = pWrap;
@@ -1774,12 +1756,10 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(Enum_StdInterfaces index)
else if (index == enum_IDispatchEx)
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
RETURN NULL;
}
-#endif // FEATURE_CORECLR
if (SupportsIReflect(m_pMT))
{
@@ -1988,9 +1968,6 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(REFIID riid)
// Keeping the Apollo behaviour also ensures that we allow SL 8.1 scenarios (which do not pass the AppX flag like the modern host)
// to use CorDispatcher for async, in the expected manner, as the OS implementation for CoreDispatcher expects objects to be Agile.
if (!IsAggregated()
-#if !defined(FEATURE_CORECLR)
- && AppX::IsAppXProcess()
-#endif // !defined(FEATURE_CORECLR)
)
{
ComCallWrapperTemplate *pTemplate = GetComCallWrapperTemplate();
@@ -2741,11 +2718,7 @@ ComCallWrapper* ComCallWrapper::CreateWrapper(OBJECTREF* ppObj, ComCallWrapperTe
pServer = *ppObj;
-#ifdef FEATURE_REMOTING
- Context *pContext = Context::GetExecutionContext(pServer);
-#else
Context *pContext = GetAppDomain()->GetDefaultContext();
-#endif
// Force Refine the object if it is a transparent proxy
RefineProxy(pServer);
@@ -3614,12 +3587,10 @@ IUnknown* ComCallWrapper::GetComIPFromCCW(ComCallWrapper *pWrap, REFIID riid, Me
}
if (IsIDispatch(riid))
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
RETURN NULL;
}
-#endif // FEATURE_CORECLR
// We don't do visibility checks on IUnknown.
RETURN pWrap->GetIDispatchIP();
@@ -4735,11 +4706,6 @@ BOOL ComMethodTable::LayOutInterfaceMethodTable(MethodTable* pClsMT)
SLOT *pComVtable;
unsigned i;
-#ifndef FEATURE_CORECLR
- // Skip this unnecessary expensive check for CoreCLR
- if (!CheckSigTypesCanBeLoaded(pItfClass))
- return FALSE;
-#endif
LOG((LF_INTEROP, LL_INFO1000, "LayOutInterfaceMethodTable: %s, this: %p\n", pItfClass->GetDebugClassName(), this));