문제

I have a couple of massive data structures that are causing problems in my VB.NET application. After an exception is thrown and the application pauses, I'd like to run some code like:

For Each o As MyClass In myObjects
  If o.property = "value" Then debug.print(o.id)
Next

to diagnose the problem.

The problem is that the immediate window won't let me execute loops, and the myObjects collection contains far too many objects for me to find the offending one I want manually.

How can I find this object while the debugger is paused? Is this, or something similar, possible in the .NET IDE?

도움이 되었습니까?

해결책

You should be able to use the Immediate mode window in the IDE to execute commands like that, but the data has to be available within the current scope of the debugger.

다른 팁

No, you can't do this directly from the IDE. Unfortunately, the easiest way to work around it is to stop debugging, write your loop inside a public static method that returns the object you are looking for, re-compile and run, and then call that public static method from the Immediate or Watch window.

Another more immediate (but annoying) trick is to write "? myObjects" in the Immediate window, copy paste the result into notepad, and use text search (Ctrl+F) in notepad to find your object.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top