Ver Fonte

2009-04-30 Marek Habersack <[email protected]>

	* BuildManager.cs: when BuildInner catches a compilation
	exception, wrap it in HttpException before re-throwing.

2009-04-30  Marek Habersack  <[email protected]>

	* TemplateParser.cs: removed the PageParserFilterTypeName
	property, the filter type name is looked up on demand now.

	* ApplicationFileParser.cs, MasterPageParser.cs,
	UserControlParser.cs: load config defaults explicitly after
	initializing the instance.

svn path=/trunk/mcs/; revision=133169
Marek Habersack há 16 anos atrás
pai
commit
dfdb975263

+ 3 - 3
mcs/class/System.Web/System.Web.Compilation/BuildManager.cs

@@ -333,7 +333,7 @@ namespace System.Web.Compilation {
 					} catch (CompilationException ex) {
 						attempts--;
 						if (singleBuild)
-							throw;
+							throw new HttpException ("Single file build failed.", ex);
 						
 						if (attempts == 0) {
 							needMainVpBuild = true;
@@ -343,7 +343,7 @@ namespace System.Web.Compilation {
 						
 						CompilerResults results = ex.Results;
 						if (results == null)
-							throw;
+							throw new HttpException ("No results returned from failed compilation.", ex);
 						else
 							RemoveFailedAssemblies (vpabsolute, ex, abuilder, group, results, debug);
 					}
@@ -373,7 +373,7 @@ namespace System.Web.Compilation {
 					// In theory this code is unreachable. If the recursive
 					// build of the main vp failed, then it should have thrown
 					// the build exception.
-					throw compilationError;
+					throw new HttpException ("Requested virtual path build failed.", compilationError);
 				}
 			}
 		}

+ 5 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,8 @@
+2009-04-30  Marek Habersack  <[email protected]>
+
+	* BuildManager.cs: when BuildInner catches a compilation
+	exception, wrap it in HttpException before re-throwing.
+
 2009-04-28  Marek Habersack  <[email protected]>
 
 	* AspGenerator.cs: ProcessTag doesn't process a tag which is not

+ 2 - 0
mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs

@@ -50,6 +50,7 @@ namespace System.Web.UI
 #if NET_2_0
 			VirtualPath = new VirtualPath ("/" + Path.GetFileName (fname));
 #endif
+			LoadConfigDefaults ();
 		}
 
 #if NET_2_0
@@ -70,6 +71,7 @@ namespace System.Web.UI
 				InputFile = inputFile;
 			
 			SetBaseType (null);
+			LoadConfigDefaults ();
 		}
 #endif
 		

+ 9 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,12 @@
+2009-04-30  Marek Habersack  <[email protected]>
+
+	* TemplateParser.cs: removed the PageParserFilterTypeName
+	property, the filter type name is looked up on demand now.
+
+	* ApplicationFileParser.cs, MasterPageParser.cs,
+	UserControlParser.cs: load config defaults explicitly after
+	initializing the instance.
+
 2009-04-29  Marek Habersack  <[email protected]>
 
 	* DataBinder.cs: GetPropertyValue must throw also if propName is

+ 2 - 0
mcs/class/System.Web/System.Web.UI/MasterPageParser.cs

@@ -55,6 +55,7 @@ namespace System.Web.UI
 			this.cacheEntryName = String.Concat ("@@MasterPagePHIDS:", virtualPath, ":", inputFile);
 			
 			contentPlaceHolderIds = HttpRuntime.InternalCache.Get (this.cacheEntryName) as List <string>;
+			LoadConfigDefaults ();
 		}
 
 		internal MasterPageParser (VirtualPath virtualPath, TextReader reader, HttpContext context)
@@ -68,6 +69,7 @@ namespace System.Web.UI
 			this.cacheEntryName = String.Concat ("@@MasterPagePHIDS:", virtualPath, ":", InputFile);
 			
 			contentPlaceHolderIds = HttpRuntime.InternalCache.Get (this.cacheEntryName) as List <string>;
+			LoadConfigDefaults ();
 		}
 		
 		public static MasterPage GetCompiledMasterInstance (string virtualPath, string inputFile, HttpContext context)

+ 13 - 16
mcs/class/System.Web/System.Web.UI/TemplateParser.cs

@@ -127,7 +127,6 @@ namespace System.Web.UI {
 		string codeFileBaseClass;
 		string metaResourceKey;
 		Type codeFileBaseClassType;
-		string pageParserFilterTypeName;
 		Type pageParserFilterType;
 		PageParserFilter pageParserFilter;
 		
@@ -192,9 +191,6 @@ namespace System.Web.UI {
 		internal virtual void LoadConfigDefaults ()
 		{
 			debug = CompilationConfig.Debug;
-#if NET_2_0
-			pageParserFilterTypeName = PagesConfig.PageParserFilterType;
-#endif
 		}
 		
 		internal void AddApplicationAssembly ()
@@ -1050,19 +1046,16 @@ namespace System.Web.UI {
 			set { md5checksum = value; }
 		}
 
-		internal string PageParserFilterTypeName {
-			get { return pageParserFilterTypeName; }
-		}
-
 		internal PageParserFilter PageParserFilter {
 			get {
 				if (pageParserFilter != null)
 					return pageParserFilter;
 
-				if (String.IsNullOrEmpty (pageParserFilterTypeName))
+				Type t = PageParserFilterType;
+				if (t == null)
 					return null;
-
-				pageParserFilter = Activator.CreateInstance (PageParserFilterType) as PageParserFilter;
+				
+				pageParserFilter = Activator.CreateInstance (t) as PageParserFilter;
 				pageParserFilter.Initialize (this);
 
 				return pageParserFilter;
@@ -1071,9 +1064,14 @@ namespace System.Web.UI {
 		
 		internal Type PageParserFilterType {
 			get {
-				if (pageParserFilterType == null)
-					pageParserFilterType = Type.GetType (PageParserFilterTypeName, true);
-
+				if (pageParserFilterType == null) {
+					string typeName = PagesConfig.PageParserFilterType;
+					if (String.IsNullOrEmpty (typeName))
+						return null;
+					
+					pageParserFilterType = Type.GetType (typeName, true);
+				}
+				
 				return pageParserFilterType;
 			}
 		}
@@ -1421,5 +1419,4 @@ namespace System.Web.UI {
 		}
 #endif
 	}
-}
-
+}

+ 4 - 1
mcs/class/System.Web/System.Web.UI/UserControlParser.cs

@@ -84,6 +84,7 @@ namespace System.Web.UI
 			InputFile = inputFile;
 			SetBaseType (type);
 			AddApplicationAssembly ();
+			LoadConfigDefaults ();
 		}
 
 		internal UserControlParser (VirtualPath virtualPath, TextReader reader, HttpContext context)
@@ -96,7 +97,7 @@ namespace System.Web.UI
 			VirtualPath = virtualPath;
 			Context = context;
 			BaseVirtualDir = virtualPath.DirectoryNoNormalize;
-
+			
 			if (String.IsNullOrEmpty (inputFile))
 				InputFile = virtualPath.PhysicalPath;
 			else
@@ -105,6 +106,7 @@ namespace System.Web.UI
 			Reader = reader;
 			SetBaseType (null);
 			AddApplicationAssembly ();
+			LoadConfigDefaults ();
 		}
 
 		internal UserControlParser (TextReader reader, int? uniqueSuffix, HttpContext context)
@@ -122,6 +124,7 @@ namespace System.Web.UI
 			Reader = reader;
 			SetBaseType (null);
 			AddApplicationAssembly ();
+			LoadConfigDefaults ();
 		}		
 
 		internal static Type GetCompiledType (TextReader reader, int? inputHashCode, HttpContext context)