Bug 7877 - CDATA handling broken in aspx editor
Summary: CDATA handling broken in aspx editor
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: ASP.Net ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-16 19:33 UTC by Csaba Halász
Modified: 2015-09-18 11:03 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Csaba Halász 2012-10-16 19:33:09 UTC
Add a script with CDATA and <,> signs into an aspx page, for example:

<%@ Page Language="C#" Inherits="aspbug.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
 <title>Default</title>
 <script><![CDATA[ > <test  ]]></script>
</head>
<body>
 <form id="form1" runat="server">
     <asp:Button id="button1" runat="server" Text="Click me!" OnClick="button1Clicked" />
 </form>
</body>
</html>

The editor will underline the </script> and complain that
"Parser Error: Closing tag 'script' does not match opening tag 'test'."

Similarly, trying to compile the project gives a warning:
Default.aspx(31,31): Warning: Parser failed with error Closing tag 'script' does not match opening tag 'test'.. CodeBehind members for this file will not be added.

I believe the problem is in monodevelop/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Parser.Internal/AspParser.cs. 

Apparently the parser in MonoDevelop.AspNet.StateEngine is also broken, not sure what uses that, though.
Comment 1 Mikayla Hutchinson [MSFT] 2012-10-16 20:45:31 UTC
The parse in MonoDevelop.AspNet.StateEngine is used for code completion and the indenter. This is the "new" parser.

MonoDevelop.AspNet.Parser.Internal/AspParser.cs is the old ASP.NET parser that was imported from Mono several years ago. It's used for folding, the document outline, and codebehind generation.

There is a pull request at https://github.com/mono/monodevelop/pull/223 to replace the old parser with the new one.
Comment 2 Csaba Halász 2012-10-16 21:16:15 UTC
Thanks for the info. I have quickly tried that pull request, but the parser in that is also broken. For the above example it produces:

Default.aspx(1,1): Warning: Parser failed with error Unexpected '<' in unnamed tag.. CodeBehind members for this file will not be added.

It's highlighting the </head> tag on line 7 (notice the message says line 1 though).
Comment 3 Matt Ward 2015-09-18 11:03:59 UTC
Unable to reproduce this in Xamarin Studio 5.9 so it seems to have been fixed at some point.