2009-07-08 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Wed, 8 Jul 2009 11:54:37 +0000 (11:54 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Wed, 8 Jul 2009 11:54:37 +0000 (11:54 -0000)
* TemplateControlCompilerTest.cs: added test for bug #520024

2009-07-08  Marek Habersack  <mhabersack@novell.com>

* Makefile (TEST_RESOURCE_FILES): added
Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx

2009-07-08  Marek Habersack  <mhabersack@novell.com>

* AspParser.cs: GetServerTag mustn't treat <% # ... %> as
data-binding directives. Fixes bug #520024

* AssemblyBuilder.cs: if debugging information is on, append
/d:DEBUG to the compiler's command line.

svn path=/trunk/mcs/; revision=137558

mcs/class/System.Web/ChangeLog
mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Compilation/AspParser.cs
mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/Test/System.Web.Compilation/ChangeLog
mcs/class/System.Web/Test/System.Web.Compilation/TemplateControlCompilerTest.cs
mcs/class/System.Web/Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx [new file with mode: 0644]

index 35f2952cb71c25ce99d5045bc99b49cf5199f30c..bec76f5e0a56393f77e2e26c744a4228468d45d8 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-08  Marek Habersack  <mhabersack@novell.com>
+
+       * Makefile (TEST_RESOURCE_FILES): added
+       Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx
+
 2009-07-06  Raja R Harinath  <harinath@hurrynot.org>
 
        * Makefile (TEST_MCS_FLAGS): Reference SystemWebTestShim.
index bf9393cf37db9a4342e0bab58a455d0f2b9f25c5..73f8477ef22c5d35b54cf03cc2112919a447f67f 100644 (file)
@@ -170,7 +170,8 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx \
        Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx \
        Test/mainsoft/NunitWebResources/ServerSideControlsInScriptBlock.aspx \
-       Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx
+       Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx \
+       Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx
 
 RESX_DIST =  resources/TranslationResources.resx
 ifneq (1, $(FRAMEWORK_VERSION_MAJOR))
index 7b2a5b0b7a5a9d740b3c518820eb6e46f38fe264..a1bd316354a54ebd6bdd94fff0ac0012c2e8ae6f 100644 (file)
@@ -538,9 +538,18 @@ namespace System.Web.Compilation
                        bool databinding;
                        varname = Eat ('=');
                        databinding = !varname && Eat ('#');
-
+                       string odds = tokenizer.Odds;
+                       
                        tokenizer.Verbatim = true;
                        inside_tags = GetVerbatim (tokenizer.get_token (), "%>");
+                       if (databinding && odds != null && odds.Length > 0) {
+                               databinding = false;
+
+                               // We encountered <% #something here %>, this should be passed
+                               // verbatim to the compiler
+                               inside_tags = '#' + inside_tags;
+                       }                       
+
                        tokenizer.Verbatim = false;
                        id = inside_tags;
                        attributes = null;
index ac6a09fa847f0848f20cef3cb52727cc9d5ac362..8e46bb78768bb124e3a8d01a246707e7cfa87c7c 100644 (file)
@@ -759,6 +759,16 @@ namespace System.Web.Compilation {
 
                        if (units.Length == 0 && files.Count == 0 && resources.Count == 0 && options.EmbeddedResources.Count == 0)
                                return null;
+
+                       if (options.IncludeDebugInformation) {
+                               string compilerOptions = options.CompilerOptions;
+                               if (String.IsNullOrEmpty (compilerOptions))
+                                       compilerOptions = "/d:DEBUG";
+                               else if (compilerOptions.IndexOf ("d:DEBUG", StringComparison.OrdinalIgnoreCase) == -1)
+                                       compilerOptions += " /d:DEBUG";
+                               
+                               options.CompilerOptions = compilerOptions;
+                       }
                        
                        string filename;
                        StreamWriter sw = null;
index ee84a2531225f643f980a96222b4944b98d23a57..7cc8301b589a2caff72e494823773c7c48b1c6a8 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-08  Marek Habersack  <mhabersack@novell.com>
+
+       * AspParser.cs: GetServerTag mustn't treat <% # ... %> as
+       data-binding directives. Fixes bug #520024
+
+       * AssemblyBuilder.cs: if debugging information is on, append
+       /d:DEBUG to the compiler's command line.
+
 2009-06-30  Marek Habersack  <mhabersack@novell.com>
 
        * AspGenerator.cs: TextParsed must remove client-side comments
index b3855d0aa907a57849ab31f7c4b5f2247416ca3b..97d16cbf2188fa4ae6982530a21bbcc6f102b5d2 100644 (file)
@@ -1,3 +1,7 @@
+2009-07-08  Marek Habersack  <mhabersack@novell.com>
+
+       * TemplateControlCompilerTest.cs: added test for bug #520024
+
 2009-07-06  Raja R Harinath  <harinath@hurrynot.org>
 
        * TemplateControlCompilerTest.cs (InvalidPropertyBindTest1):
index 34dcc5e8430baeecf1620cbf0afc30e269ee9a85..6a8e24eb4d5dffe546086513a93052a7b6f9b228 100644 (file)
@@ -71,6 +71,7 @@ namespace MonoTests.System.Web.Compilation {
                        WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.master", "ContentPlaceHolderInTemplate.master");
                        WebTest.CopyResource (GetType (), "LinkInHeadWithEmbeddedExpression.aspx", "LinkInHeadWithEmbeddedExpression.aspx");
                        WebTest.CopyResource (GetType (), "ExpressionInListControl.aspx", "ExpressionInListControl.aspx");
+                       WebTest.CopyResource (GetType (), "PreprocessorDirectivesInMarkup.aspx", "PreprocessorDirectivesInMarkup.aspx");
 #endif
                }
                
@@ -192,6 +193,13 @@ namespace MonoTests.System.Web.Compilation {
                        string originalHtml = @"<script type=""text/javascript"">alert (escape(""reporting/location?report=ViewsByDate&minDate=minDate&maxDate=maxDate""));</script>";
                        HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
                }
+
+               [Test (Description="Bug #520024")]
+               public void PreprocessorDirectivesInMarkup ()
+               {
+                       // Just test if it doesn't throw an exception
+                       new WebTest ("PreprocessorDirectivesInMarkup.aspx").Run ();
+               }
 #endif
 
                [Test (Description="Bug #517656")]
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx
new file mode 100644 (file)
index 0000000..918f6a6
--- /dev/null
@@ -0,0 +1,12 @@
+<%@ Page Language="C#" %>
+<html><head><title>Bug 520024</title></head>
+<body>
+<form runat="server">
+<% #if DEBUG %>
+       Debug mode
+<% #else %>
+       Normal mode
+<% #endif %>
+</form>
+</body>
+</html>