Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break on specific Guid using Visual Studio Conditional Breakpoint

I want to use a conditional breakpoint to break when a variable of type Guid has a particular value.

I know how to add a conditional breakpoint. I've tried to write a condition like this:

departmentId == new Guid("MYGUIDHERE")

But this does not work, it doesn't break. Can anyone tell me how to do this properly?

like image 244
Paul Siersma Avatar asked Apr 07 '16 14:04

Paul Siersma


2 Answers

I have tried setting the conditional break point as you did, but it shows the error:Error

I guess that action is not supported. So, the alternative way should be:

departmentId.ToString() == "MYGUIDHERE"

In my example, the expression would be:

deptId.ToString() == "ca761232-ed42-11ce-bacd-00aa0057b223"

Another way is using Guid.Parse(string), like this:

deptId == Guid.Parse("ca761232-ed42-11ce-bacd-00aa0057b223")
like image 200
Triet Doan Avatar answered Oct 13 '22 10:10

Triet Doan


if departmentId is of type Guid.

departmentId.toString() == "your guid"
like image 27
BobbyJ Avatar answered Oct 13 '22 10:10

BobbyJ