Bug 12832 - Parser error using inline server tags inside html tag attribute
Summary: Parser error using inline server tags inside html tag attribute
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: ASP.Net ()
Version: 4.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: master
Assignee: Bugzilla
URL:
: 13949 14749 ()
Depends on:
Blocks:
 
Reported: 2013-06-22 07:26 UTC by axelc4
Modified: 2014-03-31 03:38 UTC (History)
6 users (show)

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


Attachments
Parser error inline tags (1.27 MB, image/png)
2013-09-15 04:47 UTC, axelc4
Details


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:
VERIFIED FIXED

Description axelc4 2013-06-22 07:26:53 UTC
Hi, I'm getting parser errors whenever I put a server tag inside an attribute of a html tag. For example, this works:

<span id='test'><%=DateTime.Now.Day.ToString()%></span>

But this returns the parser error

<span id='<%=DateTime.Now.Day.ToString()%>'>test</span>

The error says "Unexpected '<' in tag 'span'".
Comment 1 Mikayla Hutchinson [MSFT] 2013-07-29 15:59:32 UTC
FYI support for this is partially implemented (https://github.com/mono/monodevelop/blob/master/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetSpeculativeExpressionState.cs) but not yet connected up.
Comment 2 Mikayla Hutchinson [MSFT] 2013-08-14 12:51:01 UTC
*** Bug 13949 has been marked as a duplicate of this bug. ***
Comment 3 Kirill Muzykov 2013-09-02 09:37:31 UTC
Is there a workaround for this? I'm a newbie in asp.net mono(been using asp.net on windows for 5 years), but doesn''t  bug makes any databinding controls unusable?
Comment 4 Michael Thwaite 2013-09-02 10:25:26 UTC
@kmuzykov@gmail.com release 4.0.3 doesn't suffer this issue and, for ASP.NET work is full featured.
Comment 5 Kirill Muzykov 2013-09-02 10:39:35 UTC
Hi Michael, 

Thanks for reply. I'm complete noob in developing for ASP.NET Mono, trying to port some simple ASP.NET project for first time, so this easily can be my mistake somewhere, but here is what I have.

Xamarin Studio 4.0.12 (build 3), Web Application project and this code in .aspx

<asp:Repeater ID='lstProjects' runat="server">
    <ItemTemplate>
	 <a href='<%# Eval("Name") %>'>
...

And I get this build error:
/Users/.../Default.aspx.designer.cs(15,15): Error: Unexpected '<' in tag 'a'. (WebXamarin)
Comment 6 Michael Thwaite 2013-09-02 11:45:08 UTC
Kirill,

Your code looks spot on but there's an error in the parser. Version 4.0.3 should work fine. I don't know if Xamarin has a repository for older versions but you can find Xamariin 4.0.3 for Mac here https://docs.google.com/file/d/0Bz-iyaH5nBcrdHd0SFFJOWZKRW8/edit?usp=sharing

MPT
Comment 7 Michael Thwaite 2013-09-02 11:45:47 UTC
Kirill,

Your code looks spot on but there's an error in the parser. Version 4.0.3 should work fine. I don't know if Xamarin has a repository for older versions but you can find Xamariin 4.0.3 for Mac here https://docs.google.com/file/d/0Bz-iyaH5nBcrdHd0SFFJOWZKRW8/edit?usp=sharing

MPT
Comment 8 Kirill Muzykov 2013-09-02 13:26:00 UTC
Michael, thanks for your help. I think I'll just use VM with Windows and Visual Studio, Server is running windows anyway. Just thought to start using mono to avoid switching between mac & win.

Thanks,
Kirill
Comment 9 Michael Thwaite 2013-09-02 13:43:00 UTC
Kirill, try the Mac version, it's seriously smooth by comparison! Plus, you get the kudos of telling the world how you develop ASP.NET apps in c# on your Mac - best of all worlds :-)
Comment 10 Mikayla Hutchinson [MSFT] 2013-09-08 23:33:36 UTC
Fixed in https://github.com/mono/monodevelop/commit/a13f9ac4a898c0d63008113ddc343f15a79c6f67
Comment 11 axelc4 2013-09-14 06:42:35 UTC
The parser still recognizes this as an error, but now the project builds.
However, having this inline tags inside databound server-side controls (or non databound) prevents project from building, i.e. :

<asp:Label ID="Label1" runat="server" Text='<%# Bind("id") %>'></asp:Label>

Maybe this should be reported as a new bug?
Comment 12 Mikayla Hutchinson [MSFT] 2013-09-15 01:09:56 UTC
This was fixed - see comment #10. Please don't reopen unless you can repro with a build that is supposed to include the fix.
Comment 13 Mikayla Hutchinson [MSFT] 2013-09-15 01:10:18 UTC
*** Bug 14749 has been marked as a duplicate of this bug. ***
Comment 14 axelc4 2013-09-15 04:47:17 UTC
Created attachment 4888 [details]
Parser error inline tags

Error persist version 4.1.11 (build 10)
Comment 15 axelc4 2013-09-15 04:48:11 UTC
I've built the latest tagged version I could find after the commit mentioned here and the error persists, am I building the wrong version ?
Comment 16 Mikayla Hutchinson [MSFT] 2013-09-15 12:36:19 UTC
I don't believe there is a tagged version that includes that commit yet. DDid you try the tip of master?
Comment 17 axelc4 2013-09-15 19:49:33 UTC
Yes I did but I got missing references errors, I'll just wait till the next tagged version, thanks for then help!
Comment 18 Mikayla Hutchinson [MSFT] 2013-09-28 22:05:22 UTC
*** Bug 13574 has been marked as a duplicate of this bug. ***
Comment 19 Sadik Ali 2014-03-31 03:21:57 UTC
I have verified this issue, I have checked this by  using code mentioned in bug description, in comment 5 and in comment 11. I build and debug application successfully.

I am not getting any build error, Hence marking this issue as verified
Screen cast: http://screencast.com/t/FYJLXC1NEg

Build Info:

=== Xamarin Studio ===
Version 4.2.4 (build 266)
Installation UUID: 400bab6b-f5cd-4e84-a1d1-39f9d6414cb1
Runtime:
 Microsoft .NET 4.0.30319.18449
 GTK+ 2.24.22 (MS-Windows theme)
 GTK# 2.12.25

=== Build Information ===
Release ID: 402040266
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba

=== Operating System ===
Windows 6.2.9200.0 (64-bit)
Comment 20 Sadik Ali 2014-03-31 03:38:42 UTC
Also I have verified on Mac

Screen cast: http://screencast.com/t/zMA3RRR9zPa

Build Info:
=== Xamarin Studio ===
Version 4.2.4 (build 266)
Installation UUID: 0b7eaebc-a0ed-4b58-81df-91e378cad28c
Runtime:
	Mono 3.4.0 ((no/d4511ef)
	GTK+ 2.24.23 (Raleigh theme)

=== Xamarin.Mac ===
Xamarin.Mac: 1.8.0.7

=== Build Information ===

Release ID: 402040266
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba

=== Operating System ===
Mac OS X 10.8.5