[Mono-bugs] [Bug 520024] New: The Mono compiler can't handle conditionals in <% %> script blocks (ex: <% #if DEBUG %>

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 7 20:52:59 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=520024


           Summary: The Mono compiler can't handle conditionals in <% %>
                    script blocks (ex: <% #if DEBUG %>
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Other.
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: steve at smartz.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;
Trident/4.0; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30; .NET CLR 3.0.04506.648; InfoPath.2; .NET CLR 3.5.21022; .NET CLR
3.5.30428; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.3;
OfficeLivePatch.0.0)

In a number of our .aspx files, we use conditional script blocks like:

<% #if DEBUG %>
  <link href="debug1.css" type="text/css" rel="stylesheet" />
  <link href="debug2.css" type="text/css" rel="stylesheet" />
<% #else %>
  <link href="release.css" type="text/css" rel="stylesheet" />
<# endif %>

This works under .Net.

This fails under Mono with error messages of the form:

cs1525: unexpected symbol 'if'

Interestingly, I bumped into another unexpected behavior when I tried to work
around it.  I commented the preceeding code as follows:

<!-- <% #if DEBUG %> -->
  <link href="debug1.css" type="text/css" rel="stylesheet" />
  <link href="debug2.css" type="text/css" rel="stylesheet" />
<!--
<% #else %>
  <link href="release.css" type="text/css" rel="stylesheet" />
<# endif %>
-->

I expected that the preprocessor would strip out the sections commented using
<!-- -->.

Instead, under Mono, I continued to receive the CS1525 error.

I was able to comment it out as follows:

<!-- <% // #if DEBUG %> -->
  <link href="debug1.css" type="text/css" rel="stylesheet" />
  <link href="debug2.css" type="text/css" rel="stylesheet" />
<!--
<% // #else %>
  <link href="release.css" type="text/css" rel="stylesheet" />
<# // endif %>
-->

This also commented out the release portion of the .aspx file:

<% // #if DEBUG %>
  <link href="debug1.css" type="text/css" rel="stylesheet" />
  <link href="debug2.css" type="text/css" rel="stylesheet" />
<% // #else %>
<!--
  <link href="release.css" type="text/css" rel="stylesheet" />
-->
<# // endif %>

I assume the last effectively created three empty script blocks and just
commented out the release link.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list