0

In the case of a message in the output window in Visual Studio showing

The thread 0xc28 has exited with code 0

How do I know what thread it belongs to? For example, if its one I added or a system thread, etc?

Frank Boyne
  • 4,400
  • 23
  • 30
  • Can you please post the complete error statement or a screenshot? – Mikaal Anwar May 19 '18 at 23:17
  • That is a little late, you would have to be interested in threads in the first place. As visible from the Debug > Windows > Threads window. The notification *is* a bit noisy, easy to run off. Right-click the Output window. – Hans Passant May 20 '18 at 00:34

1 Answers1

0

You should pause the program in the debugger and open the thread window in Visual Studio. You'll find it in the "Debug" tab in the menu bar in the "Window" sub-menu. In this window, you'll be able to see all active threads their locations and their Process IDs. This will help you find out where that thread came from.

Mikaal Anwar
  • 1,720
  • 10
  • 21
  • Would that still be the case if the thread already exited and there a way to figure out which one did exit? The message is "The thread 0xc28 has exited with code 0" –  May 19 '18 at 23:23
  • This would only work if the thread is active at the time you've hit your breakpoint. From there you can even freeze/thaw selected threads and debug individually, but if the relevant thread has exited by then, it wouldn't show up there. – Mikaal Anwar May 19 '18 at 23:25
  • This might be useful ... https://stackoverflow.com/questions/10315862/get-list-of-threads – Mikaal Anwar May 19 '18 at 23:34