public override ModuleDesc ResolveAssembly(System.Reflection.AssemblyName name, bool throwErrorIfNotFound) { #if SUPPORTS_NATIVE_METADATA_TYPE_LOADING AssemblyBindResult bindResult; Exception failureException; if (!AssemblyBinderImplementation.Instance.Bind(name, out bindResult, out failureException)) { if (throwErrorIfNotFound) { throw failureException; } return(null); } var moduleList = Internal.Runtime.TypeLoader.ModuleList.Instance; IntPtr primaryModuleHandle = moduleList.GetModuleForMetadataReader(bindResult.Reader); NativeFormatMetadataUnit metadataUnit = ResolveMetadataUnit(primaryModuleHandle); return(metadataUnit.GetModule(bindResult.ScopeDefinitionHandle)); #else return(null); #endif }
public override ModuleDesc ResolveAssembly(System.Reflection.AssemblyName name, bool throwErrorIfNotFound) { #if SUPPORTS_NATIVE_METADATA_TYPE_LOADING AssemblyBindResult bindResult; Exception failureException; if (!AssemblyBinderImplementation.Instance.Bind(name, out bindResult, out failureException)) { if (throwErrorIfNotFound) { throw failureException; } return(null); } var moduleList = Internal.Runtime.TypeLoader.ModuleList.Instance; if (bindResult.Reader != null) { NativeFormatModuleInfo primaryModule = moduleList.GetModuleInfoForMetadataReader(bindResult.Reader); NativeFormatMetadataUnit metadataUnit = ResolveMetadataUnit(primaryModule); return(metadataUnit.GetModule(bindResult.ScopeDefinitionHandle)); } #if ECMA_METADATA_SUPPORT else if (bindResult.EcmaMetadataReader != null) { EcmaModuleInfo ecmaModule = moduleList.GetModuleInfoForMetadataReader(bindResult.EcmaMetadataReader); return(ResolveEcmaModule(ecmaModule)); } #endif else { // Should not be possible to reach here throw new Exception(); } #else return(null); #endif }