summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve MacLean <stmaclea@microsoft.com>2019-03-27 17:24:00 -0400
committerGitHub <noreply@github.com>2019-03-27 17:24:00 -0400
commit66c05cea421a9f388eaebece2b9e64ce4560c5c5 (patch)
tree4ba14774b9e34a64559f193d797b7628116b0239 /src
parentc3e1bd5ccc482c9a7670762676bda95ebd34707d (diff)
downloadcoreclr-66c05cea421a9f388eaebece2b9e64ce4560c5c5.tar.gz
coreclr-66c05cea421a9f388eaebece2b9e64ce4560c5c5.tar.bz2
coreclr-66c05cea421a9f388eaebece2b9e64ce4560c5c5.zip
Extend WindowsEventLog test for EntryPointFilter (#23178)
* Extend WindowsEventLog test Verify EntryPointFilter solves logging problem with native host swallowing exceptions WindowsEventLog only look at new entries WindowsEventLog remove time check Add mechanism to corhost to emulate host swallowing all exceptions * PR feedback
Diffstat (limited to 'src')
-rw-r--r--src/inc/clrconfigvalues.h2
-rw-r--r--src/vm/corhost.cpp19
-rw-r--r--src/vm/excep.cpp20
3 files changed, 34 insertions, 7 deletions
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h
index a8b4270d4d..86a6166d1a 100644
--- a/src/inc/clrconfigvalues.h
+++ b/src/inc/clrconfigvalues.h
@@ -269,6 +269,8 @@ CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_AssertOnFailFast, W("AssertOnFailFast")
RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_legacyCorruptedStateExceptionsPolicy, W("legacyCorruptedStateExceptionsPolicy"), 0, "Enabled Pre-V4 CSE behavior", CLRConfig::FavorConfigFile)
CONFIG_DWORD_INFO_EX(INTERNAL_SuppressLostExceptionTypeAssert, W("SuppressLostExceptionTypeAssert"), 0, "", CLRConfig::REGUTIL_default)
RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_FailFastOnCorruptedStateException, W("FailFastOnCorruptedStateException"), 0, "Failfast if a CSE is encountered", CLRConfig::FavorConfigFile)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_UseEntryPointFilter, W("UseEntryPointFilter"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_Corhost_Swallow_Uncaught_Exceptions, W("Corhost_Swallow_Uncaught_Exceptions"), 0, "", CLRConfig::REGUTIL_default)
///
/// Garbage collector
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index e02b514f5e..40d8fff2dc 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -460,10 +460,23 @@ HRESULT CorHost2::ExecuteAssembly(DWORD dwAppDomainId,
arguments->SetAt(i, argument);
}
- DWORD retval = pAssembly->ExecuteMainMethod(&arguments, TRUE /* waitForOtherThreads */);
- if (pReturnValue)
+ if(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_Corhost_Swallow_Uncaught_Exceptions))
{
- *pReturnValue = retval;
+ EX_TRY
+ DWORD retval = pAssembly->ExecuteMainMethod(&arguments, TRUE /* waitForOtherThreads */);
+ if (pReturnValue)
+ {
+ *pReturnValue = retval;
+ }
+ EX_CATCH_HRESULT (hr)
+ }
+ else
+ {
+ DWORD retval = pAssembly->ExecuteMainMethod(&arguments, TRUE /* waitForOtherThreads */);
+ if (pReturnValue)
+ {
+ *pReturnValue = retval;
+ }
}
GCPROTECT_END();
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index 6d62f9c691..213e4b6b4c 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -5139,17 +5139,29 @@ LONG InternalUnhandledExceptionFilter(
} // LONG InternalUnhandledExceptionFilter()
-static bool s_useEntryPointFilter = false;
+
+// Represent the value of USE_ENTRYPOINT_FILTER as passed in the property bag to the host during construction
+static bool s_useEntryPointFilterCorhostProperty = false;
void ParseUseEntryPointFilter(LPCWSTR value)
{
-#ifdef PLATFORM_WINDOWS // This feature has only been tested on Windows, keep it disabled on other platforms
// set s_useEntryPointFilter true if value != "0"
if (value && (_wcsicmp(value, W("0")) != 0))
{
- s_useEntryPointFilter = true;
+ s_useEntryPointFilterCorhostProperty = true;
}
+}
+
+bool GetUseEntryPointFilter()
+{
+#ifdef PLATFORM_WINDOWS // This feature has only been tested on Windows, keep it disabled on other platforms
+ static bool s_useEntryPointFilterEnv = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_UseEntryPointFilter) != 0;
+
+ return s_useEntryPointFilterCorhostProperty || s_useEntryPointFilterEnv;
+#else
+ return false;
#endif
+
}
// This filter is used to trigger unhandled exception processing for the entrypoint thread
@@ -5172,7 +5184,7 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData)
return ret;
}
- if (!s_useEntryPointFilter)
+ if (!GetUseEntryPointFilter())
{
return EXCEPTION_CONTINUE_SEARCH;
}