// Return the set of managed module instances from the AppDomain. private static IEnumerable <DkmClrModuleInstance> GetModulesInAppDomain( this DkmClrRuntimeInstance runtime, DkmClrAppDomain appDomain ) { if (appDomain.IsUnloaded) { return(SpecializedCollections.EmptyEnumerable <DkmClrModuleInstance>()); } var appDomainId = appDomain.Id; // GetModuleInstances() may include instances of DkmClrNcContainerModuleInstance // which are containers of managed module instances (see GetEmbeddedModules()) // but not managed modules themselves. Since GetModuleInstances() will include the // embedded modules, we can simply ignore DkmClrNcContainerModuleInstances. return(runtime .GetModuleInstances() .OfType <DkmClrModuleInstance>() .Where( module => { var moduleAppDomain = module.AppDomain; return !moduleAppDomain.IsUnloaded && (moduleAppDomain.Id == appDomainId); } )); }
private static IEnumerable <DkmClrModuleInstance> GetModulesInAppDomain(this DkmClrRuntimeInstance runtime, DkmClrAppDomain appDomain) { var appDomainId = appDomain.Id; return(runtime.GetModuleInstances(). Cast <DkmClrModuleInstance>(). Where(module => module.AppDomain.Id == appDomainId)); }
private static IEnumerable <DkmClrModuleInstance> GetModulesInAppDomain(this DkmClrRuntimeInstance runtime, DkmClrAppDomain appDomain) { if (appDomain.IsUnloaded) { return(SpecializedCollections.EmptyEnumerable <DkmClrModuleInstance>()); } var appDomainId = appDomain.Id; return(runtime.GetModuleInstances(). Cast <DkmClrModuleInstance>(). Where(module => module.AppDomain.Id == appDomainId)); }
private static IEnumerable <DkmClrModuleInstance> GetModulesInAppDomain(this DkmClrRuntimeInstance runtime, DkmClrAppDomain appDomain) { if (appDomain.IsUnloaded) { return(SpecializedCollections.EmptyEnumerable <DkmClrModuleInstance>()); } var appDomainId = appDomain.Id; return(runtime.GetModuleInstances(). // Ignore module instances that are not DkmClrModuleInstance. // Specifically, ignore DkmClrNcContainerModuleInstance. // (The embedded DkmClrNcModuleInstance modules will // be included in GetModuleInstances and will be used.) OfType <DkmClrModuleInstance>(). Where(module => { var moduleAppDomain = module.AppDomain; return !moduleAppDomain.IsUnloaded && (moduleAppDomain.Id == appDomainId); })); }