ASP.NET MVC Razor syntax code clean up error

I tried to use resharper to clean up the following .cshtml (ASP.NET MVC Razor view) file:

@if (Roles.IsUserInRole(WebSecurity.CurrentUserName, "Administrators"))
{
    @:@this.Html.MenuItem("Users", "List", "User", null, new { title = "Manage users" })
    @:@this.Html.MenuItem("Roles", "List", "UserRole", null, new { title = "Manage user roles" })
}


The clean up result is:

@if (Roles.IsUserInRole(WebSecurity.CurrentUserName, "Administrators"))
{@:@this.Html.MenuItem("Users", "List", "User", null, new { title = "Manage users" })@:@this.Html.MenuItem("Roles", "List", "UserRole", null, new { title = "Manage user roles" })
}


The two lines inside the @{..} code block are combined to one line, which cause runtime error:

":" is not valid at the start of a code block.  Only identifiers, keywords, comments, "(" and "{" are valid.


About information:

JetBrains ReSharper 7.0.1 Full Edition
Build 7.0.1098.2760 on 2012-08-27T08:31:12

Licensed to: wub
Plugins: 1
#1. “StyleCop (4.7.37.0)” v4.7.1000.0 by http://stylecop.codeplex.com
Visual Studio 11.0.50727.1.

Copyright © 2003–2012 JetBrains s.r.o. All rights reserved.

1 comment
Avatar
Andrey Serebryansky
Comment actions Permalink

Hello Victor
     Thank you for reporting this problem! I've logged it under http://youtrack.jetbrains.com/issue/RSRP-330065 and you're welcome to vote for it.

Andrey Serebryansky

Software Developer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0

Please sign in to leave a comment.