/// <summary>
        /// Look for a type by name in the assemblies available to this page
        /// </summary>
        Type GetType(string typeName)
        {
            Type type;

            // If it contains an assembly name, just call Type.GetType (ASURT 53589)
            //
            if (ServiceParserUtilities.TypeNameIncludesAssembly(typeName))
            {
                try
                {
                    type = Type.GetType(typeName, true);
                }
                catch (ArgumentException e)
                {
                    Exception parseException = CreateParseException(e, this.sourceString);
                    throw FxTrace.Exception.AsError(
                              new HttpCompileException(parseException.Message, parseException));
                }
                catch (TargetInvocationException e)
                {
                    Exception parseException = CreateParseException(e, this.sourceString);
                    throw FxTrace.Exception.AsError(
                              new HttpCompileException(parseException.Message, parseException));
                }
                catch (TypeLoadException e)
                {
                    Exception parseException = CreateParseException(SR.Hosting_BuildProviderCouldNotCreateType(typeName), e, this.sourceString);
                    throw FxTrace.Exception.AsError(
                              new HttpCompileException(parseException.Message, parseException));
                }

                return(type);
            }

            try
            {
                type = ServiceParserUtilities.GetTypeFromAssemblies(referencedAssemblies, typeName, false /*ignoreCase*/);
                if (type != null)
                {
                    return(type);
                }

                type = ServiceParserUtilities.GetTypeFromAssemblies(AssemblyDependencies, typeName, false /*ignoreCase*/);
                if (type != null)
                {
                    return(type);
                }
            }
            catch (HttpException e)
            {
                Exception parseException = CreateParseException(SR.Hosting_BuildProviderCouldNotCreateType(typeName), e, this.sourceString);
                throw FxTrace.Exception.AsError(
                          new HttpCompileException(parseException.Message, parseException));
            }

            Exception exception = CreateParseException(SR.Hosting_BuildProviderCouldNotCreateType(typeName), this.sourceString);

            throw FxTrace.Exception.AsError(
                      new HttpCompileException(exception.Message, exception));
        }
Пример #2
0
        private Type GetType(string typeName)
        {
            Type type;

            if (ServiceParserUtilities.TypeNameIncludesAssembly(typeName))
            {
                try
                {
                    type = Type.GetType(typeName, true);
                }
                catch (ArgumentException exception)
                {
                    Exception exception2 = this.CreateParseException(exception, this.sourceString);
                    throw FxTrace.Exception.AsError(new HttpCompileException(exception2.Message, exception2));
                }
                catch (TargetInvocationException exception3)
                {
                    Exception exception4 = this.CreateParseException(exception3, this.sourceString);
                    throw FxTrace.Exception.AsError(new HttpCompileException(exception4.Message, exception4));
                }
                catch (TypeLoadException exception5)
                {
                    Exception exception6 = this.CreateParseException(System.ServiceModel.Activation.SR.Hosting_BuildProviderCouldNotCreateType(typeName), exception5, this.sourceString);
                    throw FxTrace.Exception.AsError(new HttpCompileException(exception6.Message, exception6));
                }
                return(type);
            }
            try
            {
                type = ServiceParserUtilities.GetTypeFromAssemblies(this.referencedAssemblies, typeName, false);
                if (type != null)
                {
                    return(type);
                }
                type = ServiceParserUtilities.GetTypeFromAssemblies(this.AssemblyDependencies, typeName, false);
                if (type != null)
                {
                    return(type);
                }
            }
            catch (HttpException exception7)
            {
                Exception exception8 = this.CreateParseException(System.ServiceModel.Activation.SR.Hosting_BuildProviderCouldNotCreateType(typeName), exception7, this.sourceString);
                throw FxTrace.Exception.AsError(new HttpCompileException(exception8.Message, exception8));
            }
            Exception innerException = this.CreateParseException(System.ServiceModel.Activation.SR.Hosting_BuildProviderCouldNotCreateType(typeName), this.sourceString);

            throw FxTrace.Exception.AsError(new HttpCompileException(innerException.Message, innerException));
        }