LOGW("Thread was created by user code during evaluation with implicit user code execution.");
ThreadId threadId(getThreadId(pThread));
- m_debugger.m_sharedThreads->Add(threadId);
+ m_debugger.m_sharedThreads->Add(threadId, m_debugger.m_startMethod == StartAttach);
m_debugger.pProtocol->EmitThreadEvent(ThreadEvent(ManagedThreadStarted, threadId, m_debugger.m_interopDebugging));
return m_sharedCallbacksQueue->ContinueAppDomain(pAppDomain);
return SUCCEEDED(res) && threadId != 0 ? ThreadId{threadId} : ThreadId{};
}
-void Threads::Add(const ThreadId &threadId)
+void Threads::Add(const ThreadId &threadId, bool processAttached)
{
std::unique_lock<Utility::RWLock::Writer> write_lock(m_userThreadsRWLock.writer);
m_userThreads.emplace(threadId);
- // First added user thread is Main thread for sure.
- if (!MainThread)
+ // First added user thread during start is Main thread for sure.
+ if (!processAttached && !MainThread)
MainThread = threadId;
}
std::string Threads::GetThreadName(ICorDebugProcess *pProcess, const ThreadId &userThread)
{
- if (MainThread == userThread)
- return "Main Thread";
-
std::string threadName = "<No name>";
if (m_sharedEvaluator)
}
}
+ if (MainThread && MainThread == userThread && threadName == "<No name>")
+ return "Main Thread";
+
return threadName;
}
public:
- void Add(const ThreadId &threadId);
+ void Add(const ThreadId &threadId, bool processAttached);
void Remove(const ThreadId &threadId);
HRESULT GetThreadsWithState(ICorDebugProcess *pProcess, std::vector<Thread> &threads);
#ifdef INTEROP_DEBUGGING