IDS_EE_STRUCTARRAYTOOLARGE "Array size exceeds addressing limitations."
IDS_EE_TOOMANYFIELDS "Internal limitation: too many fields."
- IDS_EE_UNHANDLED_EXCEPTION "Unhandled Exception:"
+ IDS_EE_UNHANDLED_EXCEPTION "Unhandled exception."
IDS_EE_EXCEPTION_TOSTRING_FAILED "Cannot print exception string because Exception.ToString() failed."
IDS_EE_THREAD_ABORT "Thread was being aborted."
#include "volatile.h"
-const char StackOverflowMessage[] = "Process is terminating due to StackOverflowException.\n";
+const char StackOverflowMessage[] = "Stack overflow.\n";
#endif // __cplusplus
#include "arraynative.inl"
-#define STACK_OVERFLOW_MESSAGE W("StackOverflowException")
-
/*===================================IsDigit====================================
**Returns a bool indicating whether the character passed in represents a **
**digit.
ZeroMemory(pED, sizeof(ExceptionData));
- if (objException->GetMethodTable() == g_pStackOverflowExceptionClass) {
- // In a low stack situation, most everything else in here will fail.
- // <TODO>@TODO: We're not turning the guard page back on here, yet.</TODO>
- pED->hr = COR_E_STACKOVERFLOW;
- pED->bstrDescription = SysAllocString(STACK_OVERFLOW_MESSAGE);
- return;
- }
-
GCPROTECT_BEGIN(objException);
pED->hr = GetExceptionHResult(objException);
pED->bstrDescription = GetExceptionDescription(objException);
// Arguments:
// exitCode - code of the fatal error
// pszMessage - error message (can be NULL)
-// errorSource - details on the source of the error
-// argExceptionString - exception details
+// errorSource - details on the source of the error (can be NULL)
+// argExceptionString - exception details (can be NULL)
//
// Return Value:
// None
Thread *pThread = GetThread();
EX_TRY
{
- if ((exitCode == (UINT)COR_E_FAILFAST) && (errorSource == NULL))
+ if (exitCode == (UINT)COR_E_FAILFAST)
{
- PrintToStdErrA("FailFast:\n");
+ PrintToStdErrA("Process terminated. ");
+ }
+ else
+ {
+ PrintToStdErrA("Fatal error. ");
}
if (errorSource != NULL)
LogCallstackForLogWorker();
if (argExceptionString != NULL) {
- PrintToStdErrA("\n");
- PrintToStdErrA("Exception details:");
- PrintToStdErrA("\n");
PrintToStdErrW(argExceptionString);
- PrintToStdErrA("\n");
}
}
}
void DisplayStackOverflowException()
{
LIMITED_METHOD_CONTRACT;
- PrintToStdErrA("\n");
- PrintToStdErrA("Process is terminating due to StackOverflowException.\n");
+ PrintToStdErrA("Stack overflow.\n");
}
void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pExceptionInfo, BOOL fSkipDebugger)
// FailFast with specific error code and exception details
#define EEPOLICY_HANDLE_FATAL_ERROR_USING_EXCEPTION_INFO(_exitcode, _pExceptionInfo) EEPolicy::HandleFatalError(_exitcode, GetCurrentIP(), NULL, _pExceptionInfo);
-// Failfast with specific error code, exception details, and debug info
-#define EEPOLICY_HANDLE_FATAL_ERROR_USING_EXCEPTION_AND_DEBUG_INFO(_exitcode, _pExceptionInfo, _isDebug) EEPolicy::HandleFatalError(_exitcode, GetCurrentIP(), NULL, _pExceptionInfo, _isDebug);
-
#endif // EEPOLICY_H_
case ERT_ManagedFailFast:
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_MANAGEDFAILFAST))
- m_Description.Append(W("Description: The application requested process termination through System.Environment.FailFast(string message)."));
+ m_Description.Append(W("Description: The application requested process termination through Environment.FailFast."));
else
{
m_Description.Append(ssMessage);
case ERT_UnmanagedFailFast:
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_UNMANAGEDFAILFAST))
- m_Description.Append(W("Description: The process was terminated due to an internal error in the .NET Runtime "));
+ m_Description.Append(W("Description: The process was terminated due to an internal error in the .NET Runtime."));
else
{
m_Description.Append(ssMessage);
case ERT_StackOverflow:
// Fetch the localized Stack Overflow Error text or fall back on a hardcoded variant if things get dire.
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_STACK_OVERFLOW))
- m_Description.Append(W("Description: The process was terminated due to stack overflow."));
+ m_Description.Append(W("Description: The process was terminated due to a stack overflow."));
else
{
m_Description.Append(ssMessage);
#ifndef DACCESS_COMPILE
-#define SZ_UNHANDLED_EXCEPTION W("Unhandled Exception:")
+#define SZ_UNHANDLED_EXCEPTION W("Unhandled exception.")
#define SZ_UNHANDLED_EXCEPTION_CHARLEN ((sizeof(SZ_UNHANDLED_EXCEPTION) / sizeof(WCHAR)))
GCPROTECT_BEGIN(throwable);
if (throwable != NULL)
{
- PrintToStdErrA("\n");
-
if (FAILED(UtilLoadResourceString(CCompRC::Error, IDS_EE_UNHANDLED_EXCEPTION, buf, buf_size)))
{
wcsncpy_s(buf, buf_size, SZ_UNHANDLED_EXCEPTION, SZ_UNHANDLED_EXCEPTION_CHARLEN);
// die. e.g. IsAsyncThreadException() and Exception.ToString both consume too much stack -- and can't
// be called here.
dump = FALSE;
- PrintToStdErrA("\n");
-
- if (FAILED(UtilLoadStringRC(IDS_EE_UNHANDLED_EXCEPTION, buf, buf_size)))
- {
- wcsncpy_s(buf, COUNTOF(buf), SZ_UNHANDLED_EXCEPTION, SZ_UNHANDLED_EXCEPTION_CHARLEN);
- }
-
- PrintToStdErrW(buf);
if (IsOutOfMemory)
{
- PrintToStdErrA(" OutOfMemoryException.\n");
+ PrintToStdErrA("Out of memory.\n");
}
else
{
- PrintToStdErrA(" StackOverflowException.\n");
+ PrintToStdErrA("Stack overflow.\n");
}
}
else if (SentEvent || IsAsyncThreadException(&throwable))
-nomethod System.Tests.AppDomainTests.MonitoringTotalAllocatedMemorySize
-nomethod System.Tests.AppDomainTests.MonitoringTotalProcessorTime
-nomethod System.Text.Tests.StringBuilderTests.AppendFormat
+
+# requires corefx test updates
+-nomethod System.Tests.EnvironmentTests.FailFast_ExceptionStackTrace_StackOverflowException
+-nomethod System.Tests.EnvironmentTests.FailFast_ExceptionStackTrace_InnerException
+-nomethod System.Tests.EnvironmentTests.FailFast_ExceptionStackTrace_ArgumentException
// In Core, we do not show a dialog.
// Fail in order to avoid anyone catching an exception and masking
// an assert failure.
- DebugAssertException ex;
- if (message == string.Empty)
- {
- ex = new DebugAssertException(stackTrace);
- }
- else if (detailMessage == string.Empty)
- {
- ex = new DebugAssertException(message, stackTrace);
- }
- else
- {
- ex = new DebugAssertException(message, detailMessage, stackTrace);
- }
+ DebugAssertException ex = new DebugAssertException(message, detailMessage, stackTrace);
Environment.FailFast(ex.Message, ex, errorSource);
}
}
// In Core, we do not show a dialog.
// Fail in order to avoid anyone catching an exception and masking
// an assert failure.
- DebugAssertException ex;
- if (message == string.Empty)
- {
- ex = new DebugAssertException(stackTrace);
- }
- else if (detailMessage == string.Empty)
- {
- ex = new DebugAssertException(message, stackTrace);
- }
- else
- {
- ex = new DebugAssertException(message, detailMessage, stackTrace);
- }
+ DebugAssertException ex = new DebugAssertException(message, detailMessage, stackTrace);
Environment.FailFast(ex.Message, ex, errorSource);
}
}
stackTrace = "";
}
WriteAssert(stackTrace, message, detailMessage);
- FailCore(stackTrace, message, detailMessage, "Assertion Failed");
+ FailCore(stackTrace, message, detailMessage, "Assertion failed.");
}
internal void WriteAssert(string stackTrace, string? message, string? detailMessage)
private sealed class DebugAssertException : Exception
{
- internal DebugAssertException(string? stackTrace) :
- base(Environment.NewLine + stackTrace)
+ internal DebugAssertException(string? message, string? detailMessage, string? stackTrace) :
+ base(Terminate(message) + Terminate(detailMessage) + stackTrace)
{
}
- internal DebugAssertException(string? message, string? stackTrace) :
- base(message + Environment.NewLine + Environment.NewLine + stackTrace)
+ private static string? Terminate(string? s)
{
- }
+ if (s == null)
+ return s;
- internal DebugAssertException(string? message, string? detailMessage, string? stackTrace) :
- base(message + Environment.NewLine + detailMessage + Environment.NewLine + Environment.NewLine + stackTrace)
- {
+ s = s.Trim();
+ if (s.Length > 0)
+ s += Environment.NewLine;
+
+ return s;
}
}