Visual Studio Interrupt Solutions or Relationships

I use a conditional breakpoint to determine when a variable is C# DateTimegreater than a certain time. This breakpoint will be checked approximately 50,000 times during the course.

my conditional breakpoint looks like this:

quote.Time > new DateTime(2014,2,4,3,59,0)

Without this conditional breakpoint, my test run takes about 15 seconds. A conditional breakpoint takes 45 minutes.

Is there anything I can do to speed this up without modifying the code I'm debugging to add a statement or conditional?

In any case, to calculate the DateTime variable only once? Or is it more of an architectural problem with how conditional breakpoints are implemented in the IDE?

+4
source share
3 answers

Obviously, conditional breakpoints are very slow - this is a known issue. See: http://www.bing.com/search?setmkt=en-US&q=visual+studio+conditional+breakpoint+slow

Since I know how many times my function will be called deterministic modeling, I ended up using the visual studio function Hit Count.

This allowed me not to crack the code with an operator ifand faster than iteration if my interrupt condition changed.

+1
source

why don't you stop using a conditional breakpoint and change the code until you debug it. so the code will look something like this:

int dummyx = 0;
if (quote.Time > new DateTime (2014,2,4,3,59,0 )
{

dummyx++; // put normal break point here!

}

This will work much faster.

+8
source

Just for debugging purposes, I would say create a new if statement and a dummy variable (e.g. int i = 0;) and set a breakpoint on this line. Then just go in / step through the rest of the code. Just for testing, you can always simply delete these 1-2 lines of code after testing.

An if statement (logically) containing:  if (quote.Time > new DateTime(2014,2,4,3,59,0)) { int i=0; }

+2
source

Source: https://habr.com/ru/post/1525261/


All Articles