1

I quite often stumble about code that takes too much time for the debugger to evaluate yielding to the following annoying error:

Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation.

Usually we can ignore this by just stepping further, making the debugger-thread snyc to our process and then re-evaluate our statement.

However when I attach my source-code to a running, managed process, I´m unable to step any further. As soon as I get the mentioned error, no breakpoints are hit at all nor will "Break all" let me break the execution and see the currently executing statement.

enter image description here

The yellow line produces the error mentioned above. However no breakpoint is hit after continuing, neither by using F10 ("Step over") nor F5 ("Continue"). After this I´m completely unable to debug anything in my entire codebase.

Also when I try to break debugging to see what the process is currently doing no source-code is available nor any dissambly-information, as seen here:

enter image description here

I have a few methods that run one by one in a loop. To show the entire progress after every such method my BackGroundWorker is notified:

void RunTests()
{
    foreach(var m in methods)
    {
        m.Invoke(...);
        backgroundWorker1.ReportProgress(1);
    }
}

private void InitializeComponent()
{
    this.backgroundWorker1.WorkerReportsProgress = true;
    this.backgroundWorker1.WorkerSupportsCancellation = true;
    this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.RunTests);           
}

The behaviour occurs inside the currently invoked method. I suppose it´s because of the other thread which the BackGroundWorker uses in order to notify the progress to the UI (in my case a progressbar), but that´s just a guess.

Has anyone an explanation or even better a solution which doesn´t need to re-start the process (which as I noticed yields to the exact same behaviour btw.).

MakePeaceGreatAgain
  • 35,491
  • 6
  • 60
  • 111
  • There's no question here, I assume it's "how do I stop this from happening?" – DavidG Feb 07 '18 at 15:41
  • Per the error"Function evaluation disabled... ", possible causes for a procedure call to time out include an infinite loop or endless loop: https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/function-evaluation-is-disabled – Fletcher Feb 08 '18 at 08:20
  • @FletchZhou-MSFT My question is not about why the evaluation even timed out, but why the debugger can´t proceed any further once that eror occured. – MakePeaceGreatAgain Feb 08 '18 at 08:21
  • @HimBromBeere,I know that it was not about the time out issue, but the real issue is whether the timeout issue impacts the debugging for the next steps in your side. Maybe you got this document before: https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/function-evaluation-is-disabled, but it was the possible way for you to make sure that whether it really impacts the debugging processes in your side. Or just view the Source not available error https://msdn.microsoft.com/en-us/library/3sehk0fb.aspx?f=255&MSPPError=-2147217396 – Fletcher Feb 16 '18 at 08:20
  • If the source code was related to the previous time out function, you also need to resolve the previous issue, of course, just troubleshooting the source code error in Module/thread windows to get much more information before this guess. – Fletcher Feb 16 '18 at 08:22

1 Answers1

0

This is because the exception is un-handled and Visual Studio cannot move past that line without it being handled in some manner. It is by design.
Continuing in the Visual Studio debugger after an exception occurs

Victor
  • 30
  • 6
  • How do you come to the conclusion I get an unhandled exception? There is none as far as I can tell. Apart from this your answer is just an exact copy of that one within the link. – MakePeaceGreatAgain Feb 13 '18 at 09:42