ResolveAssembly() приватный Метод

private ResolveAssembly ( string name ) : Assembly
name string
Результат System.Reflection.Assembly
        internal Assembly ResolveAssembly(object sender, ResolveEventArgs args)
        {
            FunctionAssemblyLoadContext context = GetFunctionContext(args.RequestingAssembly);
            Assembly result = null;

            if (context != null)
            {
                result = context.ResolveAssembly(args.Name);
            }

            // If we were unable to resolve the assembly, apply the current App Domain policy and attempt to load it.
            // This allows us to correctly handle retargetable assemblies, redirects, etc.
            if (result == null)
            {
                string assemblyName = ((AppDomain)sender).ApplyPolicy(args.Name);

                // If after applying the current policy, we now have a different target assembly name, attempt to load that
                // assembly
                if (string.Compare(assemblyName, args.Name) != 0)
                {
                    result = Assembly.Load(assemblyName);
                }
            }

            // If we have an function context and failed to resolve a function assembly dependency,
            // log the failure as this is usually caused by missing private assemblies.
            if (context != null && result == null)
            {
                context.TraceWriter.Warning(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find assembly '{0}'. Are you missing a private assembly file?", args.Name));
            }

            return(result);
        }
Пример #2
0
        private Assembly ResolveAssembly(object sender, ResolveEventArgs args)
        {
            FunctionAssemblyLoadContext context = GetFunctionContext(args.RequestingAssembly);
            Assembly result = null;

            if (context != null)
            {
                result = context.ResolveAssembly(args.Name);
            }

            return(result);
        }
        internal Assembly ResolveAssembly(object sender, ResolveEventArgs args)
        {
            FunctionAssemblyLoadContext context = GetFunctionContext(args.RequestingAssembly);
            Assembly result = null;

            if (context != null)
            {
                result = context.ResolveAssembly(args.Name);

                // Failed to resolve a function assembly dependency, log the failure as this
                // is usually caused by missing private assemblies.
                if (result == null)
                {
                    context.TraceWriter.Warning(string.Format(CultureInfo.InvariantCulture, "Unable to find assembly '{0}'. Are you missing a private assembly file?", args.Name));
                }
            }

            return(result);
        }