13

I suddenly started experiencing this error in Visual Studio 2015 and 2017, when trying to move the yellow cursor (next statement) in debugmode.

enter image description here

The code I want to move over is nothing special (i.e does not include any try-catch and/or exception statements) and stepping through the code (F10, F11) works normally.

Here is a code sample:

protected void Page_Load(object sender, EventArgs e)
{
        if (!IsPostBack)
        {
            ddlCountry.SelectedIndex = 0;
            ddlCountry.DataSource = new List<string>() {"Germany", "Japan"};
            ddlCountry.DataBind();
        }
}

The solution contains multiple web projects and console projects, but the error does not occur in the console projects - only in the web projects. I.e in the console projects, I can move the yellow cursor with no problems.

When I try to do the same in any other solution, I have no problems, so it seems to be something related to my current solution.

These are the things I tried so far:

  • Started Visual Studio as admin
  • Tried to move the yellow cursor in both vs2015 and vs2017 (same project, same file) - same result
  • Visual Studio 2015 repair installation
  • Start Visual Studio, using the following command "devenv.exe /resetuserdata", in order to try to reset all userdata
  • Tools --> Import and Export Settings --> Reset all settings
  • Deleted the .suo file

All the suggestions I found on Google have not proved very helpful in solving this issue, so if anyone here can assist, I would be really glad.

Hos
  • 583
  • 1
  • 6
  • 25
  • Show the line of you're on and the line of code you're trying to set the next statement to. – Jazimov Apr 19 '18 at 04:35
  • @Hos, Maybe you could share a simple sample using one drive, so we could really debug it in our side. Please also make sure that it really has no Exception in your code, for example, please enable the Exception settings under Debug menu. In addition, please right click the specific web project which has this issue, and then clean and rebuild your app before you debug it, and then debug it again with the set the next statement after it compiled successfully. The reason is that we have to make sure that you set it to the line code which was really the compiled code. – Jack Zhai Apr 19 '18 at 08:09
  • Ok, so I tried checking the exception settings in the debug menu aswell as cleaning + rebuilding my solution. Same result, same error. I then began to create an example solution for you guys, meaning I deleted all projects but one web project in my solution, but then I could not reproduce the error. So, something in this process has removed the error. The clean process was as follows: - copy entire solution folder to new folder - remove all other projects than one - remove references to other projects in solution - rebuild solution with just one web project in solution – Hos Apr 19 '18 at 18:21
  • @JackZhai-MSFT It seems I can only reproduce the error, in my original solution and ONLY if I use "attach to process". When I start the project using F5, I have no problems using "set next statement". Does that make sense? – Hos Apr 19 '18 at 18:32
  • @Hos, Not meet this issue with the Attach to process, I just know that this feature really has some limitations in default: https://social.msdn.microsoft.com/Forums/vstudio/en-US/c72323de-f551-4800-bbdf-d1f30bb1f8ea/set-next-statement-not-working-in-vs2015-debugger?forum=vsdebug, just to make this issue clearly, do you mean that it has no this issue if you just debug the specific project, could you set it if you add all projects to a new solution? – Jack Zhai Apr 20 '18 at 06:28
  • @JackZhai-MSFT I tried cloning the project in a completely new folder on my machine, but the problem still occurs when I debug using "Attach to process" – Hos Apr 23 '18 at 11:42
  • @Hos, Do you have to use the "Attach to process" for your app in your side? As you said that it works well using F5, maybe it the attach to process really impacts the debugging steps. Please try to debug your app with X86 platform, view the result. – Jack Zhai Apr 30 '18 at 03:25
  • @Hos, have you figured out the solution? I'm also experiencing this on VS2017. Used to work just fine... – Yom T. Jul 25 '18 at 04:26
  • @jom unfortunately no. I tried re-installing VS as well but no luck – Hos Jul 25 '18 at 10:40
  • Not sure what I did wrong that caused this to start failing! Wasn't even doing anything with the exception settings, it just happened. – Yom T. Jul 26 '18 at 08:36
  • Same for me - started happening out of the blue – Hos Jul 27 '18 at 06:14

4 Answers4

2

Deleting bin and obj folders from project can fix a lot of issues

Simon H
  • 508
  • 1
  • 5
  • 18
1

I had it on vs2022, Restarting vs2022 solved it, Microsoft should fix it or at least give this solution in the error message at least.

Ronen Festinger
  • 2,260
  • 1
  • 23
  • 32
0

Uncheck this (Tools --> Options)

enter image description here

james murphy
  • 1,505
  • 5
  • 31
  • 57
0

you have to change from release mode to debug mode in your solution configuration. then it works fine.

Ali Eshghi
  • 1,131
  • 1
  • 13
  • 30