VS2013 Preview ViewEngineResult.Render returning malformed html - by Nonstick101

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 794142 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 7/16/2013 10:53:59 AM
Access Restriction Public


This bug relates to the behaviour of the ViewEngineResult.Render method in VS2013 under MVC 5 however the problem is also present if I load a previously working MVC 4 project into VS2013.

In VS2012 we could use ViewEngineResult.Render to render a MVC view to a string. This was useful for generating emails from a View or for returning raw html to the client to incorporate into the UI client side using JS. 

Under VS2013 this method is returning html strings containing malformed tags. For example the following is returned if you attempt to render the About.cshml page from the pre-canned app generated when creating a new MVC application in VS2013.

<$A$> <hgroup> <h2></$A$><$B$>About</$B$><$C$>.</h2> <h3></$C$><$D$>Test page for Render View test</$D$><$E$></h3> </hgroup> <div</$E$><$F$> class="row-fluid"</$F$><$G$>> <div</$G$><$H$> class="span12"</$H$><$I$>> <p>Use this area to provide additional information.</p> </div> </div></$I$>

Note this is generated using the iis express webserver included with VS. i have not tried to deploy this to a full iis server yet so not sure if the issue lies with VS or IIS Express? I have a small test application to demonstrate the error if needed.
Sign in to post a comment.
Posted by Deon [MSFT] on 4/29/2014 at 12:30 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Nonstick101 on 7/24/2013 at 6:01 PM
I can confirm that the workaround of turning off the "Browser Link" feature does indeed fix this error. Interesting little little bug, not an immediately obvious link between the two features. Looking forward to the next release.
Posted by Kanchan [MSFT] on 7/24/2013 at 12:23 PM
Thanks for reporting this issue. The good news is that we have fixed this issue in our upcoming release. For now, the workaround is to disable the Browser Link feature. For more details on how to disable this you can see here - http://blogs.msdn.com/b/webdev/archive/2013/06/28/browser-link-feature-in-visual-studio-preview-2013.aspx.

The ASP .Net Feature Team
Posted by A Gwynn on 7/22/2013 at 12:37 PM
I am also able to reproduce the error when opening a VS 2012 MVC 4 project in VS 2013. By switching back to VS 2012 the HTML string renders correctly.
Posted by Helen [MSFT] on 7/21/2013 at 10:58 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Nonstick101 on 7/17/2013 at 1:01 PM
Also just replicated the error on another machine with a fresh install of VS2013.
Posted by Nonstick101 on 7/17/2013 at 12:57 PM
Submitted demo project. Check "WebApplication1\Views\Home\RazorTest.cshtml" for bug example. Render method is called from "WebApplication1\Controllers\HomeController.RenderRazorViewToString()"
Posted by Helen [MSFT] on 7/16/2013 at 7:50 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Macy [MSFT] on 7/16/2013 at 11:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)