public:
-private:
- // This is the root-level default load context root binder. If null, then
- // the Fusion binder is used; otherwise this binder is used.
- ReleaseHolder<ICLRPrivBinder> m_pLoadContextHostBinder;
-
- // -------------------------
- // IMPORTANT!
- // The shared and designer context binders are ONLY to be used in tool
- // scenarios. There are known issues where use of these binders will
- // cause application crashes, and interesting behaviors.
- // -------------------------
-
- // This is the default designer shared context root binder.
- // This is used as the parent binder for ImmersiveDesignerContextBinders
- ReleaseHolder<ICLRPrivBinder> m_pSharedContextHostBinder;
-
- // This is the current context root binder.
- // Normally, this variable is immutable for appdomain lifetime, but in designer scenarios
- // it may be replaced by designer context binders
- Volatile<ICLRPrivBinder *> m_pCurrentContextHostBinder;
-
-public:
- // Returns the current hosted binder, or null if none available.
- inline
- ICLRPrivBinder * GetCurrentLoadContextHostBinder() const
- {
- LIMITED_METHOD_CONTRACT;
- return m_pCurrentContextHostBinder;
- }
-
- // Returns the shared context binder, or null if none available.
- inline
- ICLRPrivBinder * GetSharedContextHostBinder() const
- {
- LIMITED_METHOD_CONTRACT;
- return m_pSharedContextHostBinder;
- }
-
- // Returns the load context binder, or null if none available.
- inline
- ICLRPrivBinder * GetLoadContextHostBinder() const
- {
- LIMITED_METHOD_CONTRACT;
- return m_pLoadContextHostBinder;
- }
-
-#ifndef DACCESS_COMPILE
-
- // This is only called from the ImmersiveDesignerContext code
- // It is protected with a managed monitor lock
- inline
- void SetSharedContextHostBinder(ICLRPrivBinder * pBinder)
- {
- LIMITED_METHOD_CONTRACT;
- pBinder->AddRef();
- m_pSharedContextHostBinder = pBinder;
- }
-
- // This is called from CorHost2's implementation of ICLRPrivRuntime::CreateAppDomain.
- // Should only be called during AppDomain creation.
- inline
- void SetLoadContextHostBinder(ICLRPrivBinder * pBinder)
- {
- LIMITED_METHOD_CONTRACT;
- pBinder->AddRef();
- m_pLoadContextHostBinder = m_pCurrentContextHostBinder = pBinder;
- }
-
- inline
- void SetCurrentContextHostBinder(ICLRPrivBinder * pBinder)
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- LockHolder lh(this);
-
-#ifdef FEATURE_COMINTEROP
- if (m_pNameToTypeMap != nullptr)
- {
- delete m_pNameToTypeMap;
- m_pNameToTypeMap = nullptr;
- }
-
- m_vNameToTypeMapVersion++;
-#endif
-
- m_pCurrentContextHostBinder = pBinder;
- }
-
-#endif // DACCESS_COMPILE
-
- // Indicates that a hosted binder is present.
- inline
- bool HasLoadContextHostBinder()
- {
- LIMITED_METHOD_CONTRACT;
- return m_pLoadContextHostBinder != nullptr;
- }
-
class ComInterfaceReleaseList
{
SArray<IUnknown *> m_objects;
_ASSERTE(szWinRtClassName != NULL);
CLRPrivBinderWinRT * pWinRtBinder = pAppDomainExamine->GetWinRtBinder();
- if (pWinRtBinder == nullptr)
- { // We are most likely in AppX mode (calling AppX::IsAppXProcess() for verification is painful in DACCESS)
-#ifndef DACCESS_COMPILE
- // Note: We should also look
- // Check designer binding context present (only in AppXDesignMode)
- ICLRPrivBinder * pCurrentBinder = pAppDomainExamine->GetLoadContextHostBinder();
- if (pCurrentBinder != nullptr)
- { // We have designer binding context, look for the type in it
- ReleaseHolder<ICLRPrivWinRtTypeBinder> pCurrentWinRtTypeBinder;
- HRESULT hr = pCurrentBinder->QueryInterface(__uuidof(ICLRPrivWinRtTypeBinder), (void **)&pCurrentWinRtTypeBinder);
-
- // The binder should be an instance of code:CLRPrivBinderAppX class that implements the interface
- _ASSERTE(SUCCEEDED(hr) && (pCurrentWinRtTypeBinder != nullptr));
-
- if (SUCCEEDED(hr))
- {
- ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE();
- pAssembly = (Assembly *)pCurrentWinRtTypeBinder->FindAssemblyForWinRtTypeIfLoaded(
- (void *)pAppDomainExamine,
- szWinRtNamespace,
- szWinRtClassName);
- }
- }
-#endif //!DACCESS_COMPILE
- if (pAssembly == nullptr)
- {
- }
- }
-
if (pWinRtBinder != nullptr)
{
ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE();