Why am I seeing multiple "The thread 0x22c8 has exited with code 259 (0x103)." messages
Asked Answered
K

1

60

I'm getting a slew of these messages in my Winforms application even though I never explicitly made any threads. Why is this happening? I've looked around for an explanation but it's hard to word an inquiry like this.

I'm using Visual Studios 2013 and this is the debug output that I'm concerned about:

The thread 0x23a4 has exited with code 259 (0x103).
The thread 0x2884 has exited with code 259 (0x103).
The thread 0x27ec has exited with code 259 (0x103).
The thread 0x1978 has exited with code 259 (0x103).
The thread 0x1534 has exited with code 259 (0x103).
The thread 0x1ad8 has exited with code 259 (0x103).
The thread 0x2938 has exited with code 259 (0x103).
The thread 0x22c8 has exited with code 259 (0x103).
Kort answered 14/3, 2014 at 3:7 Comment(1)
possible duplicate of What is a thread exit codeAbreaction
C
56

From MSDN Documentation:

Remarks

This function returns immediately. If the specified thread has not terminated and the function succeeds, the status returned is STILL_ACTIVE. If the thread has terminated and the function succeeds, the status returned is one of the following values: The exit value specified in the ExitThread or TerminateThread function. The return value from the thread function. The exit value of the thread's process. Important The GetExitCodeThread function returns a valid error code defined by the application only after the thread terminates. Therefore, an application should not use STILL_ACTIVE (259) as an error code. If a thread returns STILL_ACTIVE (259) as an error code, applications that test for this value could interpret it to mean that the thread is still running and continue to test for the completion of the thread after the thread has terminated, which could put the application into an infinite loop.

So basically it's still checking current thread from time to time.

It seems to be a bug:

http://connect.microsoft.com/VisualStudio/feedback/details/812144/vs2013-reports-incorrect-thread-exit-code

Conciliar answered 14/3, 2014 at 3:24 Comment(1)
It's easy to turn off those messages (I'm using VS 2013). Just Right-Click in the output window and uncheck the Thread Exit Messages box. For me I had to also uncheck the Module Load Messages to unclutter the Output.Cassock

© 2022 - 2024 — McMap. All rights reserved.