Ejemplo n.º 1
0
        private IEnumerable <Assembly> GetCandidateLibraries(string[] candidates)
        {
            if (candidates?.Any() != true)
            {
                return(Enumerable.Empty <Assembly>());
            }

            var candidatesResolver = new AssemblyCandidateResolver(
                _assemblies,
                new HashSet <string?>(candidates, StringComparer.OrdinalIgnoreCase),
                _logger
                );

            return(candidatesResolver.GetCandidates().Select(x => x.Assembly));
        }
        private IEnumerable <Assembly> GetCandidateLibraries(string[] candidates)
        {
            if (candidates?.Any() != true)
            {
                return(Enumerable.Empty <Assembly>());
            }

            // Sometimes all the assemblies are not loaded... so we kind of have to yolo it and try a few times until we get all of them
            var candidatesResolver = new AssemblyCandidateResolver(
                _appDomain.GetAssemblies(),
                new HashSet <string?>(candidates, StringComparer.OrdinalIgnoreCase),
                _logger
                );

            return(candidatesResolver.GetCandidates().Select(x => x.Assembly).ToArray());
        }