0

The VS2019 syntax highlighting seems to be going berzerk when confronted with a local function in an ASP.NET Core 3.1 Razor view. A function like this:

@{
  void Buttons()
  {
      <div class="col-md-12">
          <button type="submit" name="Command" value="close">Save & Close</button>
          <button type="submit" name="Command" value="save">Save & Stay</button>
          <button type="submit" name="Command" value="cancel">Cancel</button>
      </div>
  }
}

shows up highlighted as full of errors, when in fact it compiles and works just fine. Hovering the mouse pointer over the <div> pops up Cannot resolve symbol <div>. message.

Has anybody found a workaround, or do we need to wait for VS highlighting to catch up with the new syntax?

Optimax
  • 1,534
  • 2
  • 16
  • 23
  • Suggestions in this post could help https://stackoverflow.com/questions/33130521/visual-studio-cannot-resolve-model-but-razor-pages-loads – as-if-i-code Feb 19 '20 at 05:41
  • 1
    @as.if.i.code Indeed! It turns out to be a ReSharper issue. Suspending ReSharper clears the error. Even the latest update (2019.3.3) does not solve it, though. – Optimax Feb 25 '20 at 04:07
  • [JetBrains: Add support for markup in local functions and @functions in Razor views](https://youtrack.jetbrains.com/issue/RIDER-34875) – Trenton McKinney Oct 04 '20 at 02:06

1 Answers1

0

Unfortunately, the answer is "there is no answer."

There is a JetBrains issue for this problem at https://youtrack.jetbrains.com/issue/RIDER-34875

jnovack
  • 7,629
  • 2
  • 26
  • 40
ltwlf
  • 219
  • 3
  • 5