9
votes

I am having a very frustrating problem in Visual Studio. I am using Resharper, and writing tests in Nunit.

If I set a breakpoint, it does get hit, however Step In/Over and Continue do not work, and the test never finishes. Even if I set two break points, continuing won't hit the second. If I debug a test without a breakpoint, it finishes fine.

Also, often and intermittently, when I try to debug a test by setting a break point, I can't evaluate the contents of variables, but instead see this message:

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

I am using Visual Studio 2010.

Please let me know if you have any ideas of what to look at... I have scoured the web, but without any luck.

Happy to provide further information if needed.

EDIT - Example of method

Test:

[Test]
public void OneRowAddedToSourceData() {
    //Factory just returns System.Data.DataTable with correct columns.
    var sourceData = new DataTableContainerFactory().GetTargetTableContainer(DataTypeNames.EventSharedEnd);

    //GetRow just returns a populated row.
    var row = GetRow(sourceData, 123456, 123,60, 31);

    sourceData.DataTable.Rows.Add(row);
    Assert.AreEqual(1, sourceData.DataTable.Rows.Count);
}

When I set a break point on the Assert statement, and try to evaluate the data table I get this problem.

UPDATE 2! So, I have narrowed this problem down to Resharper Debugging. I changed a test class to MSTest rather than NUnit, but still got both the above problems when debugging with Resharper. However, when I ran the tests with the built in VS MSTest test runner, ALL the problems had gone!

Now I much prefer using NUnit and Resharper, so I would be very happy if someone could point me at a setting that will allow Resharper to debug properly!

2
I have seen exactly what you are talking about. It isn't Resharper/Nunit related. It happens when you try to evaluating those variables. I'll see it when I try to expand a List<> or something similar (Dictionary<,>). If you can avoid the evaluation that causes the message, you can continue to debug. Right now, I just know that when I get that error message, I stop debugging and restart, then try not to evaluate the variable that caused the problem. Would LOVE to know how to prevent this from happening. - Joel Rondeau
Thanks Joel, that is a work around for some cases, however I am often trying to evaluate exactly those variables. Very frustrating! I just hope someone here can help! - Paul Grimshaw
Is it possible a function you're evaluating is looping continuously? Can you provide a simple example of what type of tests you're seeing this in? - William Dwyer
I don't think so as intermittently the evaluation works. I have added an example above that causes the problem. - Paul Grimshaw

2 Answers

5
votes

I have a possible solution, albeit with a caveat. Did some searching and ran across this blog item. It suggests turning off Enable property evaluation and other implicit function calls from Tools->Options->Debugging->General. I turned it off and I can now go into items that previously caused this problem.

The caveat is that all the properties you're used to seeing automatically evaluated are now not being shown. Instead it states Implicit function evaluation is turned off by user. All you need to do is hit the Refresh button on a property and you can see the value, but I haven't decided whether this is a trade-off I'm willing to make.

0
votes

I've found de way to solve this problem!

Check the option DEBUG->OPTIONS AND SETTINGS->GENERAL->ENABLE PROPERTY EVALUATION AND OTHER IMPLICIT FUNCTION CALLS and uncheck the option Call string-conversion function on objects in variable windows

This worked to me!