Skip to content

Commit 572b063

Browse files
authored
Remove TSNC_IgnoreUnhandledExceptions (dotnet#103013)
1 parent 7c0f62f commit 572b063

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

src/coreclr/vm/comsynchronizable.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,6 @@ FCIMPL1(void, ThreadNative::Initialize, ThreadBaseObject* pThisUNSAFE)
507507

508508
PREFIX_ASSUME(unstarted != NULL);
509509

510-
if (AppDomain::GetCurrentDomain()->IgnoreUnhandledExceptions())
511-
{
512-
unstarted->SetThreadStateNC(Thread::TSNC_IgnoreUnhandledExceptions);
513-
}
514-
515510
pThis->SetInternal(unstarted);
516511
pThis->SetManagedThreadId(unstarted->GetThreadId());
517512
unstarted->SetExposedObject(pThis);

src/coreclr/vm/excep.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4720,31 +4720,18 @@ LONG InternalUnhandledExceptionFilter_Worker(
47204720

47214721
if (pParam->pThread != NULL)
47224722
{
4723-
BOOL fIsProcessTerminating = TRUE;
47244723

4725-
// In CoreCLR, we can be asked to not let an exception go unhandled on managed threads in a given AppDomain.
4724+
// In CoreCLR, we can be asked to not let an exception go unhandled on managed threads.
47264725
// If the exception reaches the top of the thread's stack, we simply deliver AppDomain's UnhandledException event and
47274726
// return back to the filter, instead of letting the process terminate because of unhandled exception.
47284727

4729-
// Below is how we perform the check:
4730-
//
4731-
// 1) The flag is specified on the AD when it is created by the host and all managed threads created
4732-
// in such an AD will inherit the flag. For non-finalizer and non-threadpool threads, we check the flag against the thread.
4733-
// 2) The finalizer thread always switches to the AD of the object that is going to be finalized. Thus,
4734-
// while it wont have the flag specified, the AD it switches to will.
4735-
// 3) The threadpool thread also switches to the correct AD before executing the request. The thread wont have the
4736-
// flag specified, but the AD it switches to will.
4737-
47384728
// This code must only be exercised when running as a normal filter; returning
47394729
// EXCEPTION_EXECUTE_HANDLER is not valid if this code is being invoked from
47404730
// the UEF.
47414731
// Fortunately, we should never get into this case, since the thread flag about
47424732
// ignoring unhandled exceptions cannot be set on the default domain.
47434733

4744-
if (IsFinalizerThread() || (pParam->pThread->IsThreadPoolThread()))
4745-
fIsProcessTerminating = !(AppDomain::GetCurrentDomain()->IgnoreUnhandledExceptions());
4746-
else
4747-
fIsProcessTerminating = !(pParam->pThread->HasThreadStateNC(Thread::TSNC_IgnoreUnhandledExceptions));
4734+
BOOL fIsProcessTerminating = !(AppDomain::GetCurrentDomain()->IgnoreUnhandledExceptions());
47484735

47494736
#ifndef TARGET_UNIX
47504737
// Setup the watson bucketing details for UE processing.

src/coreclr/vm/threads.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,6 @@ class Thread
537537
friend BOOL NTGetThreadContext(Thread *pThread, T_CONTEXT *pContext);
538538
friend BOOL NTSetThreadContext(Thread *pThread, const T_CONTEXT *pContext);
539539

540-
friend void CommonTripThread();
541-
542540
#ifdef FEATURE_HIJACK
543541
// MapWin32FaultToCOMPlusException needs access to Thread::IsAddrOfRedirectFunc()
544542
friend DWORD MapWin32FaultToCOMPlusException(EXCEPTION_RECORD *pExceptionRecord);
@@ -552,8 +550,6 @@ class Thread
552550

553551
friend void InitThreadManager();
554552

555-
friend void CallFinalizerOnThreadObject(Object *obj);
556-
557553
// Debug and Profiler caches ThreadHandle.
558554
friend class Debugger; // void Debugger::ThreadStarted(Thread* pRuntimeThread, BOOL fAttaching);
559555
#if defined(DACCESS_COMPILE)
@@ -706,11 +702,10 @@ class Thread
706702
// at the beginning of wait.
707703
// unused = 0x00040000,
708704
// unused = 0x00080000,
709-
TSNC_RaiseUnloadEvent = 0x00100000, // Finalize thread is raising managed unload event which
710-
// may call AppDomain.Unload.
705+
// unused = 0x00100000,
711706
// unused = 0x00200000,
712707
// unused = 0x00400000,
713-
TSNC_IgnoreUnhandledExceptions = 0x00800000, // Set for a managed thread born inside an appdomain created with the APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS flag.
708+
// unused = 0x00800000,
714709
TSNC_ProcessedUnhandledException = 0x01000000,// Set on a thread on which we have done unhandled exception processing so that
715710
// we dont perform it again when OS invokes our UEF. Currently, applicable threads include:
716711
// 1) entry point thread of a managed app

0 commit comments

Comments
 (0)