Reputation: 1477
For a C# MVC 5 application we have the following partial view:
@using some.using.here
@using some.using.here
@using some.using.here
@{
var treeItem = TempData["SELECTED_TREEITEM"] as ITreeItem;
string path = treeItem.GetIdPath(TempData.GetParentId());
User user = Session["somesessionkey"] as User;
}
<!-- Selected item from URL -->
@if (treeItem != null)
{
<input type="hidden" id="routeData" data-key="@treeItem.Key" data-treepath="@path" data-area="@TempData["SELECTED_AREA"]" data-mode="@TempData["SELECTED_MODE"]">
}
<input type="hidden" id="defaultAsset" data-default="@(user != null ? (user.DefaultAsset != null ? methodcall(value).ToString() : string.Empty) : string.Empty)" />
<input type="hidden" id="newPeriodHrs" data-newperiodhrs="@(user != null ? user.NewPeriodHrs : 48)" />
However, no matter what I do, Resharper keeps complaining with the following message:
Views\Shared\_RouteData.cshtml:18 Closing brace expected
To save you from counting, line 18 is at the end of the file.
Contrary to what Resharper might suggest, the whole project compiles and runs fine. But is there still some kind of syntax issue I'm missing? Or is Resharper just plain wrong in this case? I'm running Resharper 8.2 (C# edition).
(please excuse my poor attempt at removing sensitive information from the code, I left all braces and such intact)
Upvotes: 0
Views: 588
Reputation: 1477
Turns out the solution is really sneaky, a single slash is missing in this piece:
@if (treeItem != null)
{
<input type="hidden" id="routeData" data-key="@treeItem.Key" data-treepath="@path" data-area="@TempData["SELECTED_AREA"]" data-mode="@TempData["SELECTED_MODE"]">
}
It should look like this: data-mode="@TempData["SELECTED_MODE"]" />
Upvotes: 1