@@ -312,20 +312,18 @@ class PEAssembly final
312
312
// For Dynamic assemblies this is the fallback binder.
313
313
PTR_AssemblyBinder GetAssemblyBinder ();
314
314
315
- #ifndef DACCESS_COMPILE
316
- void SetFallbackBinder (PTR_AssemblyBinder pFallbackBinder)
317
- {
318
- LIMITED_METHOD_CONTRACT;
319
- m_pFallbackBinder = pFallbackBinder;
320
- }
321
-
322
- #endif // !DACCESS_COMPILE
323
-
315
+ // For certain assemblies, we do not have m_pHostAssembly since they are not bound using an actual binder.
316
+ // An example is Ref-Emitted assemblies. Thus, when such assemblies trigger load of their dependencies,
317
+ // we need to ensure they are loaded in appropriate load context.
318
+ //
319
+ // To enable this, we maintain a concept of "FallbackBinder", which will be set to the Binder of the
320
+ // assembly that created the dynamic assembly. If the creator assembly is dynamic itself, then its fallback
321
+ // load context would be propagated to the assembly being dynamically generated.
324
322
PTR_AssemblyBinder GetFallbackBinder ()
325
323
{
326
324
LIMITED_METHOD_CONTRACT;
327
325
328
- return m_pFallbackBinder ;
326
+ return (m_pHostAssembly != NULL ) ? NULL : m_pAssemblyBinder ;
329
327
}
330
328
331
329
// ------------------------------------------------------------
@@ -341,7 +339,7 @@ class PEAssembly final
341
339
342
340
static PEAssembly* Open (BINDER_SPACE::Assembly* pBindResult);
343
341
344
- static PEAssembly* Create (IMetaDataAssemblyEmit* pEmit);
342
+ static PEAssembly* Create (IMetaDataAssemblyEmit* pEmit, AssemblyBinder* pFallbackBinder );
345
343
346
344
// ------------------------------------------------------------
347
345
// Utility functions
@@ -372,6 +370,7 @@ class PEAssembly final
372
370
BINDER_SPACE::Assembly* pBindResultInfo,
373
371
IMetaDataEmit* pEmit,
374
372
BOOL isSystem,
373
+ AssemblyBinder* pFallbackBinder = NULL ,
375
374
PEImage* pPEImageIL = NULL ,
376
375
BINDER_SPACE::Assembly* pHostAssembly = NULL
377
376
);
@@ -425,15 +424,7 @@ class PEAssembly final
425
424
bool m_isSystem;
426
425
427
426
PTR_BINDER_SPACE_Assembly m_pHostAssembly;
428
-
429
- // For certain assemblies, we do not have m_pHostAssembly since they are not bound using an actual binder.
430
- // An example is Ref-Emitted assemblies. Thus, when such assemblies trigger load of their dependencies,
431
- // we need to ensure they are loaded in appropriate load context.
432
- //
433
- // To enable this, we maintain a concept of "FallbackBinder", which will be set to the Binder of the
434
- // assembly that created the dynamic assembly. If the creator assembly is dynamic itself, then its fallback
435
- // load context would be propagated to the assembly being dynamically generated.
436
- PTR_AssemblyBinder m_pFallbackBinder;
427
+ PTR_AssemblyBinder m_pAssemblyBinder;
437
428
438
429
friend struct cdac_data <PEAssembly>;
439
430
}; // class PEAssembly
@@ -442,6 +433,7 @@ template<>
442
433
struct cdac_data <PEAssembly>
443
434
{
444
435
static constexpr size_t PEImage = offsetof(PEAssembly, m_PEImage);
436
+ static constexpr size_t AssemblyBinder = offsetof(PEAssembly, m_pAssemblyBinder);
445
437
};
446
438
447
439
typedef ReleaseHolder<PEAssembly> PEAssemblyHolder;
0 commit comments