Conditional breakpoint not working

怎甘沉沦 提交于 2019-12-06 12:43:36

问题


The above code has a conditional breakpoint set at its bottom line in yellow followed by the Breakpoint Settings dialog which should work with: item.Value == "aday"

However I get the below error, I have searched online for this and can't find any reason why this should fail. Im using VS 2015 Pro.

EDIT- Thank you for pointing out the obvious error on my part, I do normally code in C#. But now using a single '=' I get this??????? I assume that I it equates to an assignment, and adding parenthesis didn't help either?


回答1:


Just tested with a sample VB.NET project.
The problem is the ==. This is C# syntax but since you have a VB.NET application you should use a single equal

item.Value = "aday" 

(I have always something new to learn from SO)




回答2:


I am using the C# in Visual Studio 2017.

After search in an hour, conclusion was:

rewrite the conditional expression from:

item.Value == "aday"

to:

item != null && item.Value == "aday"

MAKE SURE item was not null. so that you can refer to field of value with item.Value




回答3:


If item.Value.Equals("aday") Then 'Temp If please remove
                    Debugger.Break()
                end if

Actually works in strict mode, Gasp!!!!

Thanks to all contributions, greatly appreciated :)



来源:https://stackoverflow.com/questions/36479548/conditional-breakpoint-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!