Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to set the next statement. The next statement cannot be changed at this time

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.

like image 892
Hos Avatar asked Apr 18 '18 17:04

Hos


2 Answers

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.

like image 54
Ronen Festinger Avatar answered Oct 23 '22 14:10

Ronen Festinger


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

like image 1
Simon H Avatar answered Oct 23 '22 16:10

Simon H