System.Web.Compilation.BaseCompiler.GetCompiledType C# (CSharp) Method

GetCompiledType() private method

private GetCompiledType ( ) : Type
return System.Type
		public virtual Type GetCompiledType () 
		{
			Type type = CachingCompiler.GetTypeFromCache (parser.InputFile);
			if (type != null)
				return type;

			ConstructType ();
			string lang = parser.Language;
			string tempdir;
			string compilerOptions;
			int warningLevel;

			Provider = CreateProvider (parser.Context, lang, out compilerOptions, out warningLevel, out tempdir);
			if (Provider == null)
				throw new HttpException ("Configuration error. Language not supported: " +
							  lang, 500);

			CompilerParameters parameters = CompilerParameters;
			parameters.IncludeDebugInformation = parser.Debug;
			parameters.CompilerOptions = compilerOptions + " " + parser.CompilerOptions;
			parameters.WarningLevel = warningLevel;
			
			bool keepFiles = (Environment.GetEnvironmentVariable ("MONO_ASPNET_NODELETE") != null);

			if (tempdir == null || tempdir == "")
				tempdir = DynamicDir ();
				
			TempFileCollection tempcoll = new TempFileCollection (tempdir, keepFiles);
			parameters.TempFiles = tempcoll;
			string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true));
			parameters.OutputAssembly = Path.Combine (DynamicDir (), dllfilename);

			CompilerResults results = CachingCompiler.Compile (this);
			CheckCompilerErrors (results);
			Assembly assembly = results.CompiledAssembly;
			if (assembly == null) {
				if (!File.Exists (parameters.OutputAssembly)) {
					results.TempFiles.Delete ();
					throw new CompilationException (parser.InputFile, results.Errors,
						"No assembly returned after compilation!?");
				}

				assembly = Assembly.LoadFrom (parameters.OutputAssembly);
			}

			results.TempFiles.Delete ();
			Type mainClassType = assembly.GetType (MainClassType, true);

			if (parser.IsPartial) {
				// With the partial classes, we need to make sure we
				// don't have any methods that should have not been
				// created (because they are accessible from the base
				// types). We cannot do this normally because the
				// codebehind file is actually a partial class and we
				// have no way of identifying the partial class' base
				// type until now.
				if (!isRebuilding && CheckPartialBaseType (mainClassType)) {
					isRebuilding = true;
					parser.RootBuilder.ResetState ();
					return GetCompiledType ();
				}
			}

			return mainClassType;
		}