Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio ridiculously slow debugging

I am attempting to debug a program in VS2010 using a breakpoint with a boolean condition. This particular breakpoint is painfully slow, making my program run hundreds of times slower than without the condition or using a regular unconditioned breakpoint.

My question is, is this a common issue with visual studio, I can't believe the debugger can be this slow? The boolean expression is very simple, it simply says break the program when i == x inside a for loop.

Any help appreciated as it's making debugging very painful.

Thanks Richard

        public static RawNetCalculationResults newCATXLNets(IList<Loss> RawLosses, IList<ReinsuranceProgramme> Programme) //Loss contains the properties Year, EventID, Loss Value
    {
        List<Recoveries> NetRawLosses = new List<Recoveries>(RawLosses.Count * Programme.Count);    //Initiate list with required capacity

        //Loop over each element in RawLosses List and do some calculations
        foreach (var e in RawLosses)
        {                           //<----BREAK POINT HERE (e.Year == x)
            foreach (var layer in Programme.Where(x => x.Type == ReinsuranceType.CATXL))
            {
like image 861
Richard Todd Avatar asked Jan 04 '13 10:01

Richard Todd


1 Answers

Yes, conditional breakpoints are slow.

As an alternative, you can use Debug.Assert:

Debug.Assert( i != x );

This will cause the assert to fire when i == x and you can debug from there.

like image 161
Nick Butler Avatar answered Oct 12 '22 18:10

Nick Butler