Resharper 5 - Broken Context Menu Suggestion in ASP.NET Markup

I've noticed that Resharper has a tendency to offer context menu suggestions in ASP.NET markup that will fail depending on the level of "code-soup". Take the following code for example:

<% if (!string.IsNullOrEmpty(Model.PrimaryContact.MapHtml)) { %>
<%=Model.PrimaryContact.MapHtml%>
<% }
   else {%>
<iframe width="100%" height="295" frameborder="0" scrolling="no" marginheight="0"
     marginwidth="0" src="http://maps.google.com/maps?q=<%=Url.Encode(string.Format("{0} {1}, {2} {3}", Model.PrimaryContact.Address, Model.PrimaryContact.City, Model.PrimaryContact.State, Model.PrimaryContact.PostalCode))%>&amp;mrt=yp&amp;output=embed">
</iframe>
<% }%>


A green squiggly line under the if gives me the context menu option: "Convert to method call with '?:' expression inside.". Clicking this option results in Visual Studio flickering a couple of times and then no code being changed. I am fairly confident this is because it is having problems picking the expression out of the opening and closing <% %> tags on each line, which is perfectly understandable, but the suggestion should not be offered if it won't actually be able to perform the change it shows.

Please sign in to leave a comment.