Exemplo n.º 1
0
        public Assembly Load(AssemblyName assemblyName)
        {
            // searchPaths could be in the following patterns
            // C:\HelloWorld\bin\HelloWorld.dll or
            // C:\HelloWorld\bin\HelloWorld.exe
            // C:\HelloWorld\bin\fr-FR\HelloWorld.resources.dll
            // C:\HelloWorld\bin\fr-FR\HelloWorld.resources.exe
            foreach (var searchPath in _searchPaths)
            {
                var path = searchPath;
                if (!ResourcesHelper.IsResourceNeutralCulture(assemblyName))
                {
                    path = Path.Combine(path, assemblyName.CultureName);
                }

                foreach (var extension in _extensions)
                {
                    var filePath = Path.Combine(path, assemblyName.Name + extension);

                    if (File.Exists(filePath))
                    {
                        return(_loadContext.LoadFile(filePath));
                    }
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        public Assembly Load(string name, IAssemblyLoadContext loadContext)
        {
            PackageAssembly assemblyInfo;
            if (_dependencyResolver.PackageAssemblyLookup.TryGetValue(name, out assemblyInfo))
            {
                return loadContext.LoadFile(assemblyInfo.Path);
            }

            return null;
        }
Exemplo n.º 3
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            // TODO: preserve name and culture info (we don't need to look at any other information)
            string path;
            if (_assemblies.TryGetValue(new AssemblyName(assemblyName.Name), out path))
            {
                return loadContext.LoadFile(path);
            }

            return null;
        }
Exemplo n.º 4
0
        public Assembly Load(string name, IAssemblyLoadContext loadContext)
        {
            PackageAssembly assemblyInfo;

            if (_dependencyResolver.PackageAssemblyLookup.TryGetValue(name, out assemblyInfo))
            {
                return(loadContext.LoadFile(assemblyInfo.Path));
            }

            return(null);
        }
Exemplo n.º 5
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            // TODO: preserve name and culture info (we don't need to look at any other information)
            PackageAssembly assemblyInfo;
            if (_dependencyResolver.PackageAssemblyLookup.TryGetValue(new AssemblyName(assemblyName.Name), out assemblyInfo))
            {
                return loadContext.LoadFile(assemblyInfo.Path);
            }

            return null;
        }
Exemplo n.º 6
0
        public Assembly Load(string name)
        {
            var file = Search(_assemblyDir, name, EXTENSIONS);

            if (file == null)
            {
                return(null);
            }

            return(_loadContext.LoadFile(file));
        }
Exemplo n.º 7
0
        public Assembly Load(AssemblyName assemblyName)
        {
            var assemblyPath = Path.Combine(path.FullName, assemblyName.Name + ".dll");

            if (!File.Exists(assemblyPath))
            {
                return(null);
            }

            return(context.LoadFile(assemblyPath));
        }
Exemplo n.º 8
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            // TODO: preserve name and culture info (we don't need to look at any other information)
            string path;

            if (_assemblies.TryGetValue(new AssemblyName(assemblyName.Name), out path))
            {
                return(loadContext.LoadFile(path));
            }

            return(null);
        }
Exemplo n.º 9
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            // TODO: preserve name and culture info (we don't need to look at any other information)
            PackageAssembly assemblyInfo;

            if (_dependencyResolver.PackageAssemblyLookup.TryGetValue(new AssemblyName(assemblyName.Name), out assemblyInfo))
            {
                return(loadContext.LoadFile(assemblyInfo.Path));
            }

            return(null);
        }
        Assembly IMetadataProjectReference.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            Console.WriteLine("*** PostSharpProjectReference.Load {0}.dll", _underlyingReference.Name);

            string referencePath = Path.Combine(_workingDirectory, assemblyName.Name + ".dll");

            if (File.Exists(referencePath))
            {
                return(loadContext.LoadFile(referencePath));
            }

            return(_underlyingReference.Load(assemblyName, loadContext));
        }
Exemplo n.º 11
0
        public Assembly Load(string name)
        {
            string path;

            Console.WriteLine($"Requesting {name}");
            if (_frameworkReferenceResolver.TryGetAssembly(name, _framework, out path))
            {
                Console.WriteLine($"Found {name} as {path}. Loading...");
                return(_context.LoadFile(name));
            }

            return(null);
        }
Exemplo n.º 12
0
        public Assembly Load(IAssemblyLoadContext loadContext)
        {
            string outputDir = Path.Combine(Path.GetTempPath(), "dynamic-assemblies");

            var result = Emit(outputDir, emitPdb: true, emitDocFile: false);

            if (!result.Success)
            {
                throw new CompilationException(result.Errors.ToList());
            }

            var assemblyPath = Path.Combine(outputDir, _project.Name + ".dll");

            return(loadContext.LoadFile(assemblyPath));
        }
Exemplo n.º 13
0
        private Assembly Load(string name, IAssemblyLoadContext loadContext)
        {
            string assemblyLocation;

            if (_assemblyLookupTable.TryGetValue(name, out assemblyLocation))
            {
                using (Log.LogTimedMethod())
                {
                    Log.LogVerbose($"Requested load of {name}");

                    return(loadContext.LoadFile(assemblyLocation));
                }
            }
            return(null);
        }
Exemplo n.º 14
0
        public Assembly Load(AssemblyName assemblyName)
        {
            foreach (var path in _searchPaths)
            {
                foreach (var extension in _extensions)
                {
                    var filePath = Path.Combine(path, assemblyName.Name + extension);

                    if (File.Exists(filePath))
                    {
                        return(_loadContext.LoadFile(filePath));
                    }
                }
            }

            return(null);
        }
Exemplo n.º 15
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            if (_response.Diagnostics.HasErrors())
            {
                throw new DesignTimeCompilationException(_response.Diagnostics);
            }

            if (_response.AssemblyPath != null)
            {
                return loadContext.LoadFile(_response.AssemblyPath);
            }

            if (_response.PdbBytes == null)
            {
                return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes), assemblySymbols: null);
            }

            return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes),
                                           new MemoryStream(_response.PdbBytes));
        }
        public Assembly Load(IAssemblyLoadContext loadContext)
        {
            if (_response.Errors.Any())
            {
                throw new CompilationException(_response.Errors);
            }

            if (_response.AssemblyPath != null)
            {
                return(loadContext.LoadFile(_response.AssemblyPath));
            }

            if (_response.PdbBytes == null)
            {
                return(loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes), assemblySymbols: null));
            }

            return(loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes),
                                          new MemoryStream(_response.PdbBytes)));
        }
Exemplo n.º 17
0
        public Assembly Load(IAssemblyLoadContext loadContext)
        {
            if(_response.Errors.Any())
            {
                throw new CompilationException(_response.Errors);
            }

            if (_response.AssemblyPath != null)
            {
                return loadContext.LoadFile(_response.AssemblyPath);
            }

            if (_response.PdbBytes == null)
            {
                return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes), assemblySymbols: null);
            }

            return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes),
                                           new MemoryStream(_response.PdbBytes));
        }
Exemplo n.º 18
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            if (_response.Diagnostics.HasErrors())
            {
                throw new DesignTimeCompilationException(_response.Diagnostics);
            }

            if (_response.AssemblyPath != null)
            {
                return(loadContext.LoadFile(_response.AssemblyPath));
            }

            if (_response.PdbBytes == null)
            {
                return(loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes), assemblySymbols: null));
            }

            return(loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes),
                                          new MemoryStream(_response.PdbBytes)));
        }
Exemplo n.º 19
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            string path;
            var    newAssemblyName = new AssemblyName(assemblyName.Name);

#if DNXCORE50
            newAssemblyName.CultureName = assemblyName.CultureName;
#elif DNX451
            // Assigning empty CultureInfo makes the new assembly culture as neutral which won't match the entries in _assemblies dictionary. Hence this check.
            if (assemblyName.CultureInfo != null && !ResourcesHelper.IsResourceNeutralCulture(assemblyName))
            {
                newAssemblyName.CultureInfo = assemblyName.CultureInfo;
            }
#else
#error Unhandled framework error
#endif
            if (_assemblies.TryGetValue(newAssemblyName, out path))
            {
                return(loadContext.LoadFile(path));
            }

            return(null);
        }
Exemplo n.º 20
0
        public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            string path;
            var newAssemblyName = new AssemblyName(assemblyName.Name);

            #if DNXCORE50
            newAssemblyName.CultureName = assemblyName.CultureName;
            #elif DNX451
            // Assigning empty CultureInfo makes the new assembly culture as neutral which won't match the entries in _assemblies dictionary. Hence this check.
            if (assemblyName.CultureInfo != null && !ResourcesHelper.IsResourceNeutralCulture(assemblyName))
            {
                 newAssemblyName.CultureInfo = assemblyName.CultureInfo;
            }
            #else
            #error Unhandled framework error
            #endif
            if (_assemblies.TryGetValue(newAssemblyName, out path))
            {
                return loadContext.LoadFile(path);
            }

            return null;
        }
        Assembly IMetadataProjectReference.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
        {
            Console.WriteLine("*** PostSharpProjectReference.Load {0}.dll", _underlyingReference.Name);

            string referencePath = Path.Combine(_workingDirectory, assemblyName.Name + ".dll");
            if ( File.Exists( referencePath ))
            {
                return loadContext.LoadFile(referencePath);
            }

            return _underlyingReference.Load(assemblyName, loadContext);
        }
Exemplo n.º 22
0
 public Assembly Load(AssemblyName assemblyName) =>
 _context.LoadFile(_path);
Exemplo n.º 23
0
 public Assembly Load(AssemblyName assemblyName)
 {
     return(_context.LoadFile(Path.Combine(_path, assemblyName.Name + ".dll")));
 }
 public Assembly Load(IAssemblyLoadContext loadContext)
 {
     return loadContext.LoadFile(_assemblyPath);
 }
Exemplo n.º 25
0
 public Assembly Load(AssemblyName assemblyName)
 {
     return(AssemblyLoadContext.LoadFile(Path.Combine(DirectoryPath, assemblyName + ".dll")));
 }
        public Assembly Load(IAssemblyLoadContext loadContext)
        {
            string outputDir = Path.Combine(Path.GetTempPath(), "dynamic-assemblies");

            var result = Emit(outputDir, emitPdb: true, emitDocFile: false);

            if (!result.Success)
            {
                throw new CompilationException(result.Errors.ToList());
            }

            var assemblyPath = Path.Combine(outputDir, _project.Name + ".dll");

            return loadContext.LoadFile(assemblyPath);
        }
Exemplo n.º 27
0
        private Assembly Load(string name, IAssemblyLoadContext loadContext)
        {
            string assemblyLocation;
            if (_assemblyLookupTable.TryGetValue(name, out assemblyLocation))
            {
                using (Log.LogTimedMethod())
                {
                    Log.LogVerbose($"Requested load of {name}");

                    return loadContext.LoadFile(assemblyLocation);
                }
            }
            return null;
        }
 public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
 {
     return(loadContext.LoadFile(_assemblyPath));
 }