Code Analysis incorrectly interprets Write() method in code block

Let's say I do this in a view:

<em>
                  @if (bout.OurScore > bout.OpponentScore)
                  {
                     @:Win  
                  }
                  else if (bout.OurScore < bout.OpponentScore)
                  {
                     @:Loss  
                  }
                  else {
                     @:Tie
                  }
               </em>


This is a perfectly valid contruct, and renders fine in the view. If the bout is a win, write "Win". If the bout is a loss, write "Loss". Otherwise, write "Tie".

However, Code Analysis complains of the following errors on the @:Tie line.

  • Cannot resolve method 'Write()', candidates are...
  • "@" must be followed by a valid code block




P.S. On an unrelated note... in case you're interested, this forum is completely broken in IE9. Cannot use the text editor buttons or even post a discussion using IE9. Had to switch to FF to even post this.

1 comment

Lee Dumond wrote:

This is a perfectly valid contruct, and renders fine in the view. If the bout is a win, write "Win". If the bout is a loss, write "Loss". Otherwise, write "Tie".


Hi Lee!
Issue http://youtrack.jetbrains.net/issue/RSRP-258990 is filed.

0

Please sign in to leave a comment.