Razor Syntax Oddity in 3.1

In my cshtml files I frequently initialize javascript/angular variables based on C# services using syntax like the following:

$scope.elections = JSON.parse( '@Html.Raw( Json.Serialize( _pageInitSvcs.GetElectionSets( Model.AgencyID ) ) )' );

However, under R# 3.1, the single quotes wrapping the call to @Html.Raw get flagged as errors, with the comment that a brace ({) is expected.

This isn't a huge deal, as the error doesn't keep the javascript from working...but I've come to rely on the R# visual cue that "hey, there's an error you need to fix!". So I'd like to figure out a solution. Can I tweak the rules R# uses so it doesn't flag this construct as an error?

- Mark

1 comment
Comment actions Permalink

Got this problem since ReSharper, now the Rider.

JSON.parse('<%=JsonConvert.SerializeObject(data)%>')

0

Please sign in to leave a comment.