Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2019 Right-click Go To Definition missing for WebForms

We have an Asp.Net 4.5 WebForms application that we still maintain. It uses WebForms with master pages. In VS 2019 the Go to Defintion option is completely missing when I select a form's button event and right-click. The same result when pressing the F12 key which should take me to the method definition for GetTokenButton_OnClick in the code behind page, nothing happens.

This all still works nicely in VS 2017.

Have MS dropped full support for Webforms in 2019 or am I missing an add-on or something?

This is right-click on the button event in 2017: enter image description here

This is 2019> Notice how many functions are missing: enter image description here

UPDATE: I have the same issue with a class library that is part of the same solution. When hitting F12 on any of the class library's objects referred to in the web project's code, I get the dreaded "cannot navigate to symbol under the caret" error. What is strange is that everything builds and executes.

like image 251
Neville Avatar asked Sep 15 '25 00:09

Neville


1 Answers

I had this issue earlier today after updating to VS2019 and tried all the solutions I found in Go To Definition: "Cannot navigate to the symbol under the caret.". None of those worked, but I solved it by updating the Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers versions in my NuGet Packages for the solution.

  1. Right-Click the solution file and click 'Manage NuGet packages for this Solution'
  2. Under Updates, search for 'compiler'
  3. I updated both Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers to versions that other solutions we maintain use. These were 1.0.8 and 2.4.0 respectively in my case.

After that, definitions and symbols started working again.

like image 79
Matthew Reyes Avatar answered Sep 17 '25 20:09

Matthew Reyes