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

MAF63 96 Reputation points
2021-02-08T14:02:13.093+00:00

I am having an issue with debugging a vb.net app in VS2019.
If I put a breakpoint in the code and start the application, the breakpoint is hit.
Furthermore, I can step through the code.

However, if I try to move the current line at a breakpoint to a previous line I will get an error "Unable to set the next statement. The next statement cannot be changed at this time."

I have tried different browsers with the same results.

I then created a simple console app just to see if debugging works on my VS. It does. The issue seems to be specific to the project.

Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

Accepted answer
  1. MAF63 96 Reputation points
    2021-03-17T13:29:54.317+00:00

    OK so it turns out that the problem for me is some supervisory service called "Contrast.Net Agent."

    If I stop the service, I can debug in Visual Studio as I am accustomed to.

    Why would someone put an application like this in place that hampers engineers ?

    78787-image.png


1 additional answer

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2021-02-08T14:40:49.5+00:00

    VB would indicate server side code so a browser would have no impact on that. There are several cases where you cannot change the IP to someplace else. This would include trying to move the IP inside a catch block or trying to move to another function. The documentation describes the currently unsupported scenarios. Out of the list the following come to mind:

    • In VB you cannot change to another scope
    • If you're using Edit and Continue then it will fail if you've already made changes to the code
    • In C#/VB you cannot if you are using Just In Time debugging which could happen in a web app potentially

    In general if you hit a breakpoint on a line of code and then execute that line you should be able to drag the IP back to the line again. If you can provide some sample code it is possible that you are in one of the restricted cases.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.