- Home /
GetThreadContext failed (Unity 5)
GetThreadContext failed. I had this error message long time ago when it was unity 3.5. I've read that they have fixed this problem in 4.x version, but i still have it under certain circumstances.
It started to happen when i create System.Threading.Thread and run it, eventhough it doesn't do anything but Sleep(0) in infinite loop. (EDIT: it's also checking for Queue object's count inside of lock(), which is zero all the time)
I have Win7x64 + Avast (don't know where to check for version). It seems like message doesn't show if AV is turned off. So symptoms are very similar to problem which they said they have fixed in 4.x. And yes, this message comes either in playmode and standalone windows executable.
void LoadingThread$$anonymous$$ethod()
{
try
{
while (true)
{
string key = null;
lock (m_sync)
{
if (m_loadingQueue.Count > 0)
{
// Never get here
}
}
if (key == null)
Thread.Sleep(0); //< 99% of time
else
{
// Never get here as well
}
}
}
catch (Exception ex)
{
// Same
}
}
I've erased code which never get called because m_loadingQueue.Count always == 0 until i press certain button in play mode. I can have this error message with no button pressed. By the way, i start this thread with below normal priority, if it matters
I was going to ask more questions, but yeah, sounds like it's a Unity bug. People with earlier versions were saying every Unity game they ran crashed with this when running Avast, and ESET, and some other software.