Go Back

How do you set conditional breaks based on field values in VS

I remember hearing at conference that you could set a break in VS on the basis of a field contraiinng a given value

eg, break when invoice number = 123456

This would beat adding   
if (invNo == 123456) 
     nop

and then setting a break on the NOP line

Can anyone tell me how to do this >

I am using synergy 10.3.3d, with VS 2017

 

14 Answers
1   | Posted by Gordon Ireland to Visual Studio Integration on 1/18/2018, 10:20 AM
Rachel Blunden
I'm still using VS2015 so I don't know whether this works In 2017 or not.

I set the break point and then right click on the red dot on the context menu choose conditions. I then get an option to add the condition in.

 

1/18/2018, 2:04 PM   1  
Ace Olszowka
This did not seem to work for me.

Here is how I tested it.

Create Program
main

	static record WorkVars
		i, int
	endrecord

proc

	for i from 1 thru 100
	begin
		nop
	end

endmain


Click on line 11 (the nop) to set a breakpoint
Right Click on the breakpoint set conditional expression
i == 5 like so:

User-added image

Execute Program

Doesn't work. Seems like a bug to me? If its an idea I'll vote for it.

1/18/2018, 10:41 PM   0  
Kish Baley
Agree with Ace, this doesn't seem to work, the Conditional Expression>Is true>i == 5 is treated as a normal break (break always).

I also tried it with a REPEAT loop without a NOP, thinking maybe the compiler removes the NOP line from the IL, but it never executes the Is true conditional. I tried a Hit Count>Is a multiple of >5 conditional and the program locks up. I'll send both issues to Support and see what they say. I'll add a note here with what they tell me. I'll inform them of Rachel's findings that this works in VS2015.

FYI, tested with VS2017 15.5.1, DBL 10.3.3d with 113017hotfixes.

1/19/2018, 12:05 AM   1  
Rachel Blunden
I've just retried it myself just to check and I get the following message: The condition for a breakpoint failed to execute. The condition was pol_qty==1. The error returned was 'Evaluation of method Synergex.SynergyDE.DecimalDesc.Cnvrt() requires use of the static field Synergex.SynergyDE.VariantDesc.tempAlphaPool, which is not available in this context.

I had the following code
 
quickSelect = new Select(new From("DA:pordl.ism",pol),(Where)(pol_comp==1))
  foreach pol in quickSelect
  begin
   Console.WriteLine(pol_ord_no)
  end

Ace if I try your code it does break correctly.

I'm using VS2015 Update 3
Synergy 10.3.3.1-2018 (Synergy.net)

1/19/2018, 8:47 AM   1  
Phillip Bratt
I think I should clarify something here to address Gordon's original issue and then I'll look into the failures everyone is seeing. 

The reason the right-click method is working for Rachel (initially) and not for Ace and Kish is that Rachel is using Synergy .NET, and Ace and Kish appear to be using traditional Synergy, and this functionality is different in those environments. For Synergy .NET, Rachel's method should work. For traditional Synergy, you need to run the following in the immediate window while debugging:
!WATCH invNo == 123456 (alternatively !WATCH .eq. 123456)
This will cause the debugger to break when this condition is met just like in the traditional Synergy debugger.
Hopefully that clears the confusion.
Check out the docs on traditional debugger command here for more detail: http://docs.synergyde.com/index.htm#tools/2_Debugger.htm

1/19/2018, 2:13 PM   1  
Kish Baley
Thanks for clarifying Phil.

You are correct, my test was to a traditional DBL in VS. I was actually going to test with Synergy.Net project after seeing Rachel's post, but am glad you responded first. IMO, this is not a bug, traditional has a different way of setting conditional breaks as per your post. I will NOT be opening a ticket with Support, but others are welcome to if they disagree.

1/19/2018, 2:26 PM   0  
Ace Olszowka
Yup I was testing in Traditional Synergy.

I don't think we'll bother with a ticket but an idea I think would be in order as most Visual Studio Devs that's the interface they're going to expect.

I created an idea https://synergexresourcecenter.force.com/apex/SiteIdea?id=0870d000000Xi3bAAC

Note that the !WATCH work around is closer to setting a Data Breakpoint (https://msdn.microsoft.com/en-us/library/5557y8b4.aspx#Setting%20a%20Data%20Breakpoint%20(native%20C++%20only)) and is NOT the same as a conditional breakpoint.

1/19/2018, 2:42 PM   0  
Gordon Ireland
I am trying to get this to work in  synergy.net.

I haven;t managed to get it working yet.

The latest is when I try to check if a D6 field is equal to a certain value    cllog==2445

I get an error 
User-added image 

 

1/23/2018, 4:51 PM   1  
Ace Olszowka
@Gordon looks like a similar issue to Rachel above; probably worth opening a support case. Also can you copy and paste the error? It would make that error message searchable in the future. Check out this Answers Post: https://synergexresourcecenter.force.com/SiteAnswer?id=a2Z0d000000gw83EAA

1/23/2018, 4:53 PM   0  
Gordon Ireland
Here is the error :

Evaluation of method SynergyDE.DEcimalDesc.cnvrt*( calls into native method Synergex.SynergyDE.SynRtl.WideChartoMultiByte()

Evaluation of native methods in this context is not supported

1/23/2018, 4:58 PM   1  
Rachel Blunden
What happens if the D6 is replaced with a .net type like decimal or int?

1/24/2018, 8:40 AM   0  
Gordon Ireland
I tried it with an INT field - same error

1/26/2018, 11:03 AM   0  
Kish Baley
@Gordon, I tried it in Synergy .Net using a simple for loop (break Is true i==15, where i is an int) and it works just fine. There may be something else in your code that's causing your error. Could you share your code?

1/29/2018, 1:00 PM   0  
Phillip Bratt
Wrong tracker link earlier.

Issue with Synergy .NET has a tracker:
https://resourcecenter.synergex.com/helpdesk/tracker-view.aspx?id=035914
 

2/7/2018, 5:20 PM   0  
Please log in to comment or answer this question.