@@ -503,14 +503,22 @@ bool ShouldContinueOnBreakpoint (CorThread thread, BreakEventInfo binfo)
503
503
return true ;
504
504
505
505
if ( ! string . IsNullOrEmpty ( bp . ConditionExpression ) ) {
506
- string res = EvaluateExpression ( thread , bp . ConditionExpression ) ;
507
- if ( bp . BreakIfConditionChanges ) {
508
- if ( res == bp . LastConditionValue )
509
- return true ;
510
- bp . LastConditionValue = res ;
511
- } else {
512
- if ( res != null && res . ToLower ( ) != "true" )
513
- return true ;
506
+ try {
507
+ string res = EvaluateExpression ( thread , bp . ConditionExpression ) ;
508
+ if ( bp . BreakIfConditionChanges ) {
509
+ if ( res == bp . LastConditionValue )
510
+ return true ;
511
+ bp . LastConditionValue = res ;
512
+ }
513
+ else {
514
+ if ( res != null && res . ToLower ( ) != "true" )
515
+ return true ;
516
+ }
517
+ }
518
+ catch ( EvaluatorException e ) {
519
+ OnDebuggerOutput ( false , e . Message ) ;
520
+ binfo . SetStatus ( BreakEventStatus . Invalid , e . Message ) ;
521
+ return true ;
514
522
}
515
523
}
516
524
@@ -1713,7 +1721,13 @@ string EvaluateTrace (CorThread thread, string exp)
1713
1721
if ( j == - 1 )
1714
1722
break ;
1715
1723
string se = exp . Substring ( i + 1 , j - i - 1 ) ;
1716
- se = EvaluateExpression ( thread , se ) ;
1724
+ try {
1725
+ se = EvaluateExpression ( thread , se ) ;
1726
+ }
1727
+ catch ( EvaluatorException e ) {
1728
+ OnDebuggerOutput ( false , e . ToString ( ) ) ;
1729
+ return String . Empty ;
1730
+ }
1717
1731
sb . Append ( exp . Substring ( last , i - last ) ) ;
1718
1732
sb . Append ( se ) ;
1719
1733
last = j + 1 ;
@@ -1734,7 +1748,11 @@ string EvaluateExpression (CorThread thread, string exp)
1734
1748
ctx . Thread = thread ;
1735
1749
ValueReference val = ctx . Evaluator . Evaluate ( ctx , exp ) ;
1736
1750
return val . CreateObjectValue ( false ) . Value ;
1737
- } catch ( Exception ex ) {
1751
+ }
1752
+ catch ( EvaluatorException e ) {
1753
+ throw ;
1754
+ }
1755
+ catch ( Exception ex ) {
1738
1756
OnDebuggerOutput ( true , ex . ToString ( ) ) ;
1739
1757
return string . Empty ;
1740
1758
}
0 commit comments