Beispiel #1
0
        /// <summary>
        /// Load assembly from disk
        /// </summary>
        /// <param name="location">assembly location</param>
        /// <param name="loadsymbols">load symbols</param>
        /// <returns></returns>
        public override AssemblyDefinition LoadAssembly(string location, bool loadsymbols)
        {
            ReaderParameters parameters = new ReaderParameters();

            parameters.ReadSymbols = loadsymbols;
            parameters.ReadingMode = ReadingMode.Deferred;
            var resolver = new ReflexilAssemblyResolver();

            try
            {
                return(resolver.ReadAssembly(location, parameters));
            } catch (Exception)
            {
                // perhaps pdb file is not found, just ignore this time
                if (loadsymbols)
                {
                    parameters.ReadSymbols = false;
                    return(resolver.ReadAssembly(location, parameters));
                }
                else
                {
                    throw;
                }
            }
        }
Beispiel #2
0
        public virtual AssemblyDefinition LoadAssembly(string location, bool readsymbols)
        {
            var parameters = new ReaderParameters {
                ReadSymbols = readsymbols, ReadingMode = ReadingMode.Deferred
            };
            var resolver = new ReflexilAssemblyResolver();

            try
            {
                return(resolver.ReadAssembly(location, parameters));
            }
            catch (Exception)
            {
                // perhaps pdb file is not found, just ignore this time
                if (!readsymbols)
                {
                    throw;
                }

                parameters.ReadSymbols = false;
                return(resolver.ReadAssembly(location, parameters));
            }
        }
Beispiel #3
0
        public virtual AssemblyDefinition LoadAssembly(string location, bool readsymbols)
        {
            var parameters = new ReaderParameters
            {
                ReadSymbols = readsymbols,
                ReadingMode = ReadingMode.Deferred,
                InMemory    = true,
                ThrowIfSymbolsAreNotMatching = false,
                SymbolReaderProvider         = readsymbols ? new DefaultSymbolReaderProvider(false) : null
            };
            var resolver = new ReflexilAssemblyResolver(parameters);

            return(resolver.ReadAssembly(location));
        }