Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions src/coreclr/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,21 +3223,6 @@ BOOL IsExceptionOfType(RuntimeExceptionKind reKind, OBJECTREF *pThrowable)
return CoreLibBinder::IsException(pThrowableMT, reKind);
}

BOOL IsAsyncThreadException(OBJECTREF *pThrowable) {
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_COOPERATIVE;
STATIC_CONTRACT_FORBID_FAULT;

if ( (GetThreadNULLOk() && GetThread()->IsRudeAbort() && GetThread()->IsRudeAbortInitiated())
||IsExceptionOfType(kThreadAbortException, pThrowable)
||IsExceptionOfType(kThreadInterruptedException, pThrowable)) {
return TRUE;
} else {
return FALSE;
}
}

BOOL IsUncatchable(OBJECTREF *pThrowable)
{
CONTRACTL {
Expand Down Expand Up @@ -4960,7 +4945,7 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
IsOutOfMemory)
{
// We have to be very careful. If we walk off the end of the stack, the process will just
// die. e.g. IsAsyncThreadException() and Exception.ToString both consume too much stack -- and can't
// die. e.g. Exception.ToString both consume too much stack -- and can't
// be called here.
dump = FALSE;

Expand All @@ -4973,12 +4958,6 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
PrintToStdErrA("Stack overflow.\n");
}
}
else if (IsAsyncThreadException(&throwable))
{
// We don't print anything on async exceptions, like ThreadAbort.
dump = FALSE;
INDEBUG(suppressSelectiveBreak=TRUE);
}

// Finally, should we print the message?
if (dump)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/vm/excep.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ DWORD ComputeEnclosingHandlerNestingLevel(IJitManager *pIJM, const METHODTOKEN&
BOOL IsException(MethodTable *pMT);
BOOL IsExceptionOfType(RuntimeExceptionKind reKind, OBJECTREF *pThrowable);
BOOL IsExceptionOfType(RuntimeExceptionKind reKind, Exception *pException);
BOOL IsAsyncThreadException(OBJECTREF *pThrowable);
BOOL IsUncatchable(OBJECTREF *pThrowable);
VOID FixupOnRethrow(Thread *pCurThread, EXCEPTION_POINTERS *pExceptionPointers);
BOOL UpdateCurrentThrowable(PEXCEPTION_RECORD pExceptionRecord);
Expand Down
12 changes: 11 additions & 1 deletion src/tests/baseservices/exceptions/unhandled/unhandled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ static void Main(string[] args)
{
throw new Exception("Test");
}
if (args[0] == "mainhardware")
else if (args[0] == "mainhardware")
{
string s = null;
Console.WriteLine(s.Length); // This will cause a NullReferenceException
}
else if (args[0] == "mainthreadinterrupted")
{
throw new ThreadInterruptedException("Test");
}
else if (args[0] == "foreign")
{
InvokeCallbackOnNewThread(&ThrowException);
Expand All @@ -79,6 +83,12 @@ static void Main(string[] args)
t.Start();
t.Join();
}
else if (args[0] == "secondarythreadinterrupted")
{
Thread t = new Thread(() => throw new ThreadInterruptedException("Test"));
t.Start();
t.Join();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ static void RunExternalProcess(string unhandledType, string assembly)
throw new Exception("Missing Unhandled exception header");
}
}
if (unhandledType == "mainthreadinterrupted" || unhandledType == "secondarythreadinterrupted")
{
if (lines[0] != "Unhandled exception. System.Threading.ThreadInterruptedException: Test")
{
throw new Exception("Missing Unhandled exception header");
}
}
else if (unhandledType == "foreign")
{
if (!lines[0].StartsWith("Unhandled exception. System.DllNotFoundException:") &&
Expand Down Expand Up @@ -149,8 +156,10 @@ public static void TestEntryPoint()
{
RunExternalProcess("main", "unhandled.dll");
RunExternalProcess("mainhardware", "unhandled.dll");
RunExternalProcess("mainthreadinterrupted", "unhandled.dll");
RunExternalProcess("secondary", "unhandled.dll");
RunExternalProcess("secondaryhardware", "unhandled.dll");
RunExternalProcess("secondarythreadinterrupted", "unhandled.dll");
RunExternalProcess("foreign", "unhandled.dll");
File.Delete(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dependencytodelete.dll"));
RunExternalProcess("missingdependency", "unhandledmissingdependency.dll");
Expand Down
Loading