-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I had a little bug open on the codefile stuff not working properly. The
SVN patch didn't quite handle all the conditions, so I reopened the
ticket at:
http://bugzilla.ximian.com/show_bug.cgi?id=76423
I also went through and created a patch for the code that should handle
all the cases that I found from my research on the web. It is a little
more involved, mainly because of ASP 2's use of partial classes and the
need to use variables from the ending classes.
I wrote it off today's SVN, so things should be fairly up-to-date. Also,
to test it, I created a small web application that has the three forms
of codefile/inherits and posted it in a zip file on the bug.
Feedback, suggestions, and gouged out eyeballs from reading the horror
of my code all appreciated. :)
Cheers!
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDdOzZLwDfJiZIuKARAmlqAJ9wtLJuFbJUlZfnj+wU6teXKGjxbACfftx2
CZILDeXmqA8MdFbQhno6sf0=
=13NX
-END PGP SIGNATURE-
Index: System.Web.UI/ControlBuilder.cs
===
--- System.Web.UI/ControlBuilder.cs (revision 52911)
+++ System.Web.UI/ControlBuilder.cs (working copy)
@@ -497,6 +497,19 @@
{
return CreateInstance ();
}
+
+ internal void ResetState()
+ {
+ haveParserVariable = false;
+
+ if (Children != null) {
+foreach (object child in Children) {
+ ControlBuilder cb = child as ControlBuilder;
+ if (cb != null)
+ cb.ResetState ();
+}
+ }
+ }
#endif
}
}
Index: System.Web.UI/TemplateParser.cs
===
--- System.Web.UI/TemplateParser.cs (revision 52911)
+++ System.Web.UI/TemplateParser.cs (working copy)
@@ -67,6 +67,10 @@
string oc_header, oc_custom, oc_param, oc_controls;
bool oc_shared;
OutputCacheLocation oc_location;
+#if NET_2_0
+ string src;
+ string partialClassName;
+#endif
Assembly srcAssembly;
int appAssemblyIndex = -1;
@@ -421,21 +425,48 @@
language = GetString (atts, Language, CompilationConfig.DefaultLanguage);
strictOn = GetBool (atts, Strict, CompilationConfig.Strict);
explicitOn = GetBool (atts, Explicit, CompilationConfig.Explicit);
+
+ string inherits = GetString (atts, Inherits, null);
#if NET_2_0
- string src = GetString (atts, CodeFile, null);
+ // In ASP 2, the source file is actually integrated with
+ // the generated file via the use of partial classes. This
+ // means that the code file has to be confirmed, but not
+ // used at this point.
+ src = GetString (atts, CodeFile, null);
+
+ if (src != null inherits != null) {
+// Make sure the source exists
+src = UrlUtils.Combine (BaseVirtualDir, src);
+string realPath = MapPath (src, false);
+if (!File.Exists (realPath))
+ ThrowParseException (File + src + not found);
+
+// Verify that the inherits is a valid identify not a
+// fully-qualified name.
+if (!CodeGenerator.IsValidLanguageIndependentIdentifier (inherits))
+ ThrowParseException (String.Format ('{0}' is not valid for 'inherits', inherits));
+
+// We are going to create a partial class that shares
+// the same name as the inherits tag, so reset the
+// name. The base type is changed because it is the
+// code file's responsibilty to extend the classes
+// needed.
+partialClassName = inherits;
+
+// Add the code file as an option to the
+// compiler. This lets both files be compiled at once.
+compilerOptions += + realPath;
+ } else if (inherits != null) {
+// We just set the inherits directly because this is a
+// Single-Page model.
+SetBaseType (inherits);
+ }
#else
string src = GetString (atts, Src, null);
-#endif
+
if (src != null)
srcAssembly = GetAssemblyFromSource (src);
- string inherits = GetString (atts, Inherits, null);
-#if NET_2_0
- if (srcAssembly == null)
-className = inherits;
- else
-SetBaseType (inherits);
-#else
if (inherits != null)
SetBaseType (inherits);
@@ -498,6 +529,18 @@
set { inputFile = value; }
}
+#if NET_2_0
+ internal bool IsPartial
+ {
+ get { return src != null; }
+ }
+
+ internal string PartialClassName
+ {
+ get { return partialClassName; }
+ }
+#endif
+
internal string Text
{
get { return text; }
Index: System.Web.Compilation/CachingCompiler.cs
===
--- System.Web.Compilation/CachingCompiler.cs (revision 52915)
+++ System.Web.Compilation/CachingCompiler.cs (working copy)
@@ -70,11 +70,18 @@
Cache cache = HttpRuntime.Cache;
string key = cachePrefix + compiler.Parser.InputFile;
CompilerResults results = (CompilerResults) cache [key];
+
+#if NET_2_0
+ if (!compiler.IsRebuildingPartial)
+#endif
if (results != null)
return results;