internal static RuntimeAssembly InternalLoadAssemblyName(AssemblyName assemblyRef, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext = null) { #if FEATURE_APPX if (ApplicationModel.IsUap) { if (assemblyRef.CodeBase != null) { throw new NotSupportedException(SR.Format(SR.NotSupported_AppX, "Assembly.LoadFrom")); } } #endif assemblyRef = (AssemblyName)assemblyRef.Clone(); if (assemblyRef.ProcessorArchitecture != ProcessorArchitecture.None) { // PA does not have a semantics for by-name binds for execution assemblyRef.ProcessorArchitecture = ProcessorArchitecture.None; } string?codeBase = VerifyCodeBase(assemblyRef.CodeBase); return(nLoad(assemblyRef, codeBase, null, ref stackMark, true, assemblyLoadContext)); }
private static extern RuntimeAssembly nLoad(AssemblyName fileName, string?codeBase, RuntimeAssembly?assemblyContext, ref StackCrawlMark stackMark, bool throwOnFileNotFound, AssemblyLoadContext?assemblyLoadContext = null);
internal static RuntimeAssembly InternalLoad(AssemblyName assemblyName, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext = null) => InternalLoad(assemblyName, requestingAssembly: null, ref stackMark, throwOnFileNotFound: true, assemblyLoadContext);
internal static RuntimeAssembly InternalLoad(string assemblyString, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext = null) { AssemblyName an = new AssemblyName(assemblyString); return(InternalLoadAssemblyName(an, ref stackMark, assemblyLoadContext)); }
// Locate an assembly by its name. The name can be strong or // weak. The assembly is loaded into the domain of the caller. internal static Assembly Load(AssemblyName assemblyRef, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext) { AssemblyName modifiedAssemblyRef; if (assemblyRef.CodeBase != null) { modifiedAssemblyRef = (AssemblyName)assemblyRef.Clone(); modifiedAssemblyRef.CodeBase = null; } else { modifiedAssemblyRef = assemblyRef; } return(RuntimeAssembly.InternalLoadAssemblyName(modifiedAssemblyRef, ref stackMark, assemblyLoadContext)); }
internal static RuntimeAssembly InternalLoad(string assemblyName, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext = null) => InternalLoad(new AssemblyName(assemblyName), ref stackMark, assemblyLoadContext);
public ResouceLoadContext(IJSRuntime?jSRuntime, AssemblyLoadContext?assemblyLoadContext, HttpClient?httpClient) { JSRuntime = jSRuntime; AssemblyLoadContext = assemblyLoadContext; HttpClient = httpClient; }
internal static Assembly Load(AssemblyName assemblyRef, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext) { // TODO: pass AssemblyName Assembly?assembly = InternalLoad(assemblyRef.FullName, ref stackMark, assemblyLoadContext != null ? assemblyLoadContext.NativeALC : IntPtr.Zero); if (assembly == null) { throw new FileNotFoundException(null, assemblyRef.Name); } return(assembly); }
internal static RuntimeAssembly InternalLoadAssemblyName(AssemblyName assemblyRef, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext = null) { assemblyRef = (AssemblyName)assemblyRef.Clone(); if (assemblyRef.ProcessorArchitecture != ProcessorArchitecture.None) { // PA does not have a semantics for by-name binds for execution assemblyRef.ProcessorArchitecture = ProcessorArchitecture.None; } string?codeBase = VerifyCodeBase(assemblyRef.CodeBase); return(nLoad(assemblyRef, codeBase, null, ref stackMark, true, assemblyLoadContext)); }
/// <summary> /// Enumerates all assemblies that are dependencies of the specified assembly and contain components. /// </summary> /// <param name="assembly">The origin assembly.</param> /// <param name="loadContext">The <see cref="AssemblyLoadContext"/> the origin assembly was loaded from.</param> /// <returns>An <see cref="IEnumerable{T}"/> of assemblies that contain components.</returns> public static IEnumerable <Assembly> EnumerateComponentAssemblies(Assembly assembly, AssemblyLoadContext?loadContext = null) { if (assembly is null) { throw new ArgumentNullException(nameof(assembly)); } var assemblyName = assembly.GetName(); var visited = new HashSet <Assembly>(new AssemblyComparer()); return(EnumerateAssemblies(assemblyName, loadContext, visited)); }
internal static RuntimeAssembly InternalLoad(string assemblyString, ref StackCrawlMark stackMark, AssemblyLoadContext?assemblyLoadContext = null) { RuntimeAssembly?assembly; AssemblyName an = CreateAssemblyName(assemblyString, out assembly); if (assembly != null) { // The assembly was returned from ResolveAssemblyEvent return(assembly); } return(InternalLoadAssemblyName(an, ref stackMark, assemblyLoadContext)); }