@@ -448,5 +448,134 @@ await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/Me
448448 pause_location = await SendCommandAndCheck ( JObject . FromObject ( new { } ) , "Debugger.resume" , "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs" , 38 , 8 , "StaticMethod4" ) ;
449449 locals = await GetProperties ( pause_location [ "callFrames" ] [ 0 ] [ "callFrameId" ] . Value < string > ( ) ) ;
450450 }
451+
452+ [ Fact ]
453+ public async Task ConditionalBreakpointInALoop ( )
454+ {
455+ var bp_conditional = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 4 , condition : "i == 3" ) ;
456+ var bp_check = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 5 ) ;
457+ await EvaluateAndCheck (
458+ "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);" ,
459+ "dotnet://debugger-test.dll/debugger-test.cs" ,
460+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
461+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
462+ "LoopToBreak" ,
463+ locals_fn : ( locals ) =>
464+ {
465+ CheckNumber ( locals , "i" , 3 ) ;
466+ }
467+ ) ;
468+
469+ await SendCommandAndCheck ( null , "Debugger.resume" ,
470+ null ,
471+ bp_check . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
472+ bp_check . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
473+ "LoopToBreak" ) ;
474+ }
475+
476+ [ Fact ]
477+ public async Task ConditionalBreakpointInALoopStopMoreThanOnce ( )
478+ {
479+ var bp_conditional = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 4 , condition : "i % 3 == 0" ) ;
480+ var bp_check = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 5 ) ;
481+ await EvaluateAndCheck (
482+ "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);" ,
483+ "dotnet://debugger-test.dll/debugger-test.cs" ,
484+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
485+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
486+ "LoopToBreak" ,
487+ locals_fn : ( locals ) =>
488+ {
489+ CheckNumber ( locals , "i" , 0 ) ;
490+ }
491+ ) ;
492+
493+ await SendCommandAndCheck ( null , "Debugger.resume" ,
494+ null ,
495+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
496+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
497+ "LoopToBreak" ,
498+ locals_fn : ( locals ) =>
499+ {
500+ CheckNumber ( locals , "i" , 3 ) ;
501+ } ) ;
502+
503+ await SendCommandAndCheck ( null , "Debugger.resume" ,
504+ null ,
505+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
506+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
507+ "LoopToBreak" ,
508+ locals_fn : ( locals ) =>
509+ {
510+ CheckNumber ( locals , "i" , 6 ) ;
511+ } ) ;
512+
513+ await SendCommandAndCheck ( null , "Debugger.resume" ,
514+ null ,
515+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
516+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
517+ "LoopToBreak" ,
518+ locals_fn : ( locals ) =>
519+ {
520+ CheckNumber ( locals , "i" , 9 ) ;
521+ } ) ;
522+
523+ await SendCommandAndCheck ( null , "Debugger.resume" ,
524+ null ,
525+ bp_check . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
526+ bp_check . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
527+ "LoopToBreak" ) ;
528+ }
529+
530+ [ Fact ]
531+ public async Task ConditionalBreakpointNoStopInALoop ( )
532+ {
533+ var bp_conditional = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 4 , condition : "i == \" 10\" " ) ;
534+ var bp_check = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 5 ) ;
535+ await EvaluateAndCheck (
536+ "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);" ,
537+ "dotnet://debugger-test.dll/debugger-test.cs" ,
538+ bp_check . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
539+ bp_check . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
540+ "LoopToBreak"
541+ ) ;
542+ }
543+
544+ [ Fact ]
545+ public async Task ConditionalBreakpointNotBooleanInALoop ( )
546+ {
547+ var bp_conditional = await SetBreakpointInMethod ( "debugger-test.dll" , "LoopClass" , "LoopToBreak" , 4 , condition : "i + 4" ) ;
548+ await EvaluateAndCheck (
549+ "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);" ,
550+ "dotnet://debugger-test.dll/debugger-test.cs" ,
551+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
552+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
553+ "LoopToBreak" ,
554+ locals_fn : ( locals ) =>
555+ {
556+ CheckNumber ( locals , "i" , 0 ) ;
557+ }
558+ ) ;
559+
560+ await SendCommandAndCheck ( null , "Debugger.resume" ,
561+ null ,
562+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
563+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
564+ "LoopToBreak" ,
565+ locals_fn : ( locals ) =>
566+ {
567+ CheckNumber ( locals , "i" , 1 ) ;
568+ } ) ;
569+
570+ await SendCommandAndCheck ( null , "Debugger.resume" ,
571+ null ,
572+ bp_conditional . Value [ "locations" ] [ 0 ] [ "lineNumber" ] . Value < int > ( ) ,
573+ bp_conditional . Value [ "locations" ] [ 0 ] [ "columnNumber" ] . Value < int > ( ) ,
574+ "LoopToBreak" ,
575+ locals_fn : ( locals ) =>
576+ {
577+ CheckNumber ( locals , "i" , 2 ) ;
578+ } ) ;
579+ }
451580 }
452581}
0 commit comments