Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete unused legacy hosting flags #112975

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 2 additions & 4 deletions src/coreclr/dlls/mscoree/exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ static LPCWSTR* StringArrayToUnicode(int argc, LPCSTR* argv)

static void InitializeStartupFlags(STARTUP_FLAGS* startupFlagsRef)
{
STARTUP_FLAGS startupFlags = static_cast<STARTUP_FLAGS>(
STARTUP_FLAGS::STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN |
STARTUP_FLAGS::STARTUP_SINGLE_APPDOMAIN);
STARTUP_FLAGS startupFlags = static_cast<STARTUP_FLAGS>(0);

if (Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), CLRConfig::UNSUPPORTED_gcConcurrent))
{
Expand Down Expand Up @@ -313,7 +311,7 @@ int coreclr_initialize(

hr = host->CreateAppDomainWithManager(
appDomainFriendlyNameW,
APPDOMAIN_SECURITY_DEFAULT,
0,
NULL, // Name of the assembly that contains the AppDomainManager implementation
NULL, // The AppDomainManager implementation type name
propertyCount,
Expand Down
40 changes: 0 additions & 40 deletions src/coreclr/inc/mscoree.idl
Original file line number Diff line number Diff line change
Expand Up @@ -36,58 +36,18 @@ cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0

typedef HRESULT (__stdcall *FExecuteInAppDomainCallback) (void* cookie);

// By default GC is concurrent and only the base system library is loaded into the domain-neutral area.
typedef enum {
STARTUP_CONCURRENT_GC = 0x1,

STARTUP_LOADER_OPTIMIZATION_MASK = 0x3<<1, // loader optimization mask
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = 0x1<<1, // no domain neutral loading
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = 0x2<<1, // all domain neutral loading
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = 0x3<<1, // strong name domain neutral loading
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is LoaderOptimizationAttribute specifying these flags. Now all the flags are deprecated, should the attribute be considered for deprecation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. I think you can find number of attribute types that were added for compatibility with .NET Framework and that have no effect in .NET Core.



STARTUP_LOADER_SAFEMODE = 0x10, // Do not apply runtime version policy to the version passed in
STARTUP_LOADER_SETPREFERENCE = 0x100, // Set preferred runtime. Do not actally start it

STARTUP_SERVER_GC = 0x1000, // Use server GC
STARTUP_HOARD_GC_VM = 0x2000, // GC keeps virtual address used
STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000, // Disallow mixing hosting interface
STARTUP_LEGACY_IMPERSONATION = 0x10000, // Do not flow impersonation across async points by default
STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000, // Don't eagerly commit thread stack
STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000, // Force flow impersonation across async points
// (impersonations achieved thru p/invoke and managed will flow.
// default is to flow only managed impersonation)
STARTUP_TRIM_GC_COMMIT = 0x80000, // GC uses less committed space when system memory low
STARTUP_ETW = 0x100000,
STARTUP_ARM = 0x400000, // Enable the ARM feature.
STARTUP_SINGLE_APPDOMAIN = 0x800000, // application runs in default domain, no more domains are created
STARTUP_APPX_APP_MODEL = 0x1000000, // jupiter app
STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000 // Disable the randomized string hashing (not supported)
} STARTUP_FLAGS;

typedef enum
{
APPDOMAIN_SECURITY_DEFAULT =0x0,
APPDOMAIN_SECURITY_SANDBOXED = 0x1, // appdomain is sandboxed
APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2, // no cross ad reverse pinvokes
APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4, //
APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x08, // do not pump messages during wait operations, do not call sync context
// When passed by the host, this flag will allow any assembly to perform PInvoke or COMInterop operations.
// Otherwise, by default, only platform assemblies can perform those operations.
APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10,

APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40,
APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80,

APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100,
} APPDOMAIN_SECURITY_FLAGS;

typedef enum {
WAIT_MSGPUMP = 0x1,
WAIT_ALERTABLE = 0x2,
WAIT_NOTINDEADLOCK = 0x4
}WAIT_OPTION;

typedef enum {
// Default to minidump
DUMP_FLAVOR_Mini = 0,
Expand Down
32 changes: 0 additions & 32 deletions src/coreclr/pal/prebuilt/inc/mscoree.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,48 +86,16 @@ typedef /* [public][public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0001
{
STARTUP_CONCURRENT_GC = 0x1,
STARTUP_LOADER_OPTIMIZATION_MASK = ( 0x3 << 1 ) ,
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = ( 0x1 << 1 ) ,
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = ( 0x2 << 1 ) ,
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = ( 0x3 << 1 ) ,
STARTUP_LOADER_SAFEMODE = 0x10,
STARTUP_LOADER_SETPREFERENCE = 0x100,
STARTUP_SERVER_GC = 0x1000,
STARTUP_HOARD_GC_VM = 0x2000,
STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000,
STARTUP_LEGACY_IMPERSONATION = 0x10000,
STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000,
STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000,
STARTUP_TRIM_GC_COMMIT = 0x80000,
STARTUP_ETW = 0x100000,
STARTUP_ARM = 0x400000,
STARTUP_SINGLE_APPDOMAIN = 0x800000,
STARTUP_APPX_APP_MODEL = 0x1000000,
STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000
} STARTUP_FLAGS;

typedef /* [public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0002
{
APPDOMAIN_SECURITY_DEFAULT = 0,
APPDOMAIN_SECURITY_SANDBOXED = 0x1,
APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2,
APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4,
APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x8,
APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10,
APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40,
APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80,
APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100
} APPDOMAIN_SECURITY_FLAGS;

typedef /* [public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0003
{
WAIT_MSGPUMP = 0x1,
WAIT_ALERTABLE = 0x2,
WAIT_NOTINDEADLOCK = 0x4
} WAIT_OPTION;

typedef /* [public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0004
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,6 @@ AppDomain::AppDomain()
, m_pDelayedLoaderAllocatorUnloadList{NULL}
, m_friendlyName{NULL}
, m_pRootAssembly{NULL}
, m_dwFlags{0}
, m_cRef{1}
#ifdef FEATURE_COMINTEROP
, m_pRCWCache{NULL}
Expand Down
23 changes: 0 additions & 23 deletions src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,20 +1243,6 @@ class AppDomain final
// Only call this routine when you can guarantee there are no loads in progress.
void ClearBinderContext();

void SetIgnoreUnhandledExceptions()
{
LIMITED_METHOD_CONTRACT;

m_dwFlags |= IGNORE_UNHANDLED_EXCEPTIONS;
}

BOOL IgnoreUnhandledExceptions()
{
LIMITED_METHOD_CONTRACT;

return (m_dwFlags & IGNORE_UNHANDLED_EXCEPTIONS);
}

static void ExceptionUnwind(Frame *pFrame);

BOOL IsActive()
Expand Down Expand Up @@ -1462,9 +1448,6 @@ class AppDomain final
PTR_CWSTR m_friendlyName;
PTR_Assembly m_pRootAssembly;

// General purpose flags.
DWORD m_dwFlags;

// When an application domain is created the ref count is artificially incremented
// by one. For it to hit zero an explicit close must have happened.
LONG m_cRef; // Ref count.
Expand Down Expand Up @@ -1583,12 +1566,6 @@ class AppDomain final

public:

enum {
CONTEXT_INITIALIZED = 0x0001,
// unused = 0x0400,
IGNORE_UNHANDLED_EXCEPTIONS = 0x10000, // AppDomain was created using the APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS flag
};

AssemblySpecBindingCache m_AssemblyCache;
size_t m_MemoryPressure;

Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/vm/corhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,6 @@ HRESULT CorHost2::CreateAppDomainWithManager(

ETW::LoaderLog::DomainLoad((LPWSTR)wszFriendlyName);

if (dwFlags & APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS)
pDomain->SetIgnoreUnhandledExceptions();

if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS)
pDomain->SetForceTrivialWaitOperations();

Expand Down
35 changes: 6 additions & 29 deletions src/coreclr/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ BOOL ShouldOurUEFDisplayUI(PEXCEPTION_POINTERS pExceptionInfo)
BOOL NotifyAppDomainsOfUnhandledException(
PEXCEPTION_POINTERS pExceptionPointers,
OBJECTREF *pThrowableIn,
BOOL useLastThrownObject,
BOOL isTerminating);
BOOL useLastThrownObject);

VOID SetManagedUnhandledExceptionBit(
BOOL useLastThrownObject);
Expand Down Expand Up @@ -4462,19 +4461,6 @@ LONG InternalUnhandledExceptionFilter_Worker(

if (pParam->pThread != NULL)
{

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

// This code must only be exercised when running as a normal filter; returning
// EXCEPTION_EXECUTE_HANDLER is not valid if this code is being invoked from
// the UEF.
// Fortunately, we should never get into this case, since the thread flag about
// ignoring unhandled exceptions cannot be set on the default domain.

BOOL fIsProcessTerminating = !(AppDomain::GetCurrentDomain()->IgnoreUnhandledExceptions());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality is superseded by #101560


#ifndef TARGET_UNIX
// Setup the watson bucketing details for UE processing.
// do this before notifying appdomains of the UE so if an AD attempts to
Expand All @@ -4483,14 +4469,7 @@ LONG InternalUnhandledExceptionFilter_Worker(
#endif // !TARGET_UNIX

// Send notifications to the AppDomains.
NotifyAppDomainsOfUnhandledException(pParam->pExceptionInfo, NULL, useLastThrownObject, fIsProcessTerminating /*isTerminating*/);

// If the process is not terminating, then return back to the filter and ask it to execute
if (!fIsProcessTerminating)
{
pParam->retval = EXCEPTION_EXECUTE_HANDLER;
goto lDone;
}
NotifyAppDomainsOfUnhandledException(pParam->pExceptionInfo, NULL, useLastThrownObject);
}
else
{
Expand Down Expand Up @@ -4560,7 +4539,7 @@ LONG InternalUnhandledExceptionFilter_Worker(

// Call our default catch handler to do the managed unhandled exception work.
DefaultCatchHandler(pParam->pExceptionInfo, NULL, useLastThrownObject,
TRUE /*isTerminating*/, FALSE /*isThreadBaseFIlter*/, FALSE /*sendAppDomainEvents*/, TRUE /* sendWindowsEventLog */);
FALSE /*isThreadBaseFIlter*/, FALSE /*sendAppDomainEvents*/, TRUE /* sendWindowsEventLog */);

lDone: ;
}
Expand Down Expand Up @@ -4862,7 +4841,6 @@ void STDMETHODCALLTYPE
DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
OBJECTREF *pThrowableIn,
BOOL useLastThrownObject,
BOOL isTerminating,
BOOL isThreadBaseFilter,
BOOL sendAppDomainEvents,
BOOL sendWindowsEventLog)
Expand Down Expand Up @@ -4976,7 +4954,7 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
// Send up the unhandled exception appdomain event.
if (sendAppDomainEvents)
{
SentEvent = NotifyAppDomainsOfUnhandledException(pExceptionPointers, &throwable, useLastThrownObject, isTerminating);
SentEvent = NotifyAppDomainsOfUnhandledException(pExceptionPointers, &throwable, useLastThrownObject);
}

const int buf_size = 128;
Expand Down Expand Up @@ -5073,8 +5051,7 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
BOOL NotifyAppDomainsOfUnhandledException(
PEXCEPTION_POINTERS pExceptionPointers,
OBJECTREF *pThrowableIn,
BOOL useLastThrownObject,
BOOL isTerminating)
BOOL useLastThrownObject)
{
CONTRACTL
{
Expand Down Expand Up @@ -5171,7 +5148,7 @@ BOOL NotifyAppDomainsOfUnhandledException(

// This guy will never throw, but it will need a spot to store
// any nested exceptions it might find.
SentEvent = AppDomain::OnUnhandledException(&throwable, isTerminating);
SentEvent = AppDomain::OnUnhandledException(&throwable);

UNINSTALL_NESTED_EXCEPTION_HANDLER();

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 @@ -224,7 +224,6 @@ LONG CallOutFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID pv);
void STDMETHODCALLTYPE DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionInfo,
OBJECTREF *Throwable = NULL,
BOOL useLastThrownObject = FALSE,
BOOL isTerminating = FALSE,
BOOL isThreadBaseFilter = FALSE,
BOOL sendAppDomainEvents = TRUE,
BOOL sendWindowsEventLog = FALSE);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6232,7 +6232,7 @@ UnhandledExceptionHandlerUnix(
// Unhandled exception happened, so dump the managed stack trace and terminate the process

DefaultCatchHandler(NULL /*pExceptionInfo*/, NULL /*Throwable*/, TRUE /*useLastThrownObject*/,
TRUE /*isTerminating*/, FALSE /*isThreadBaseFIlter*/, FALSE /*sendAppDomainEvents*/);
FALSE /*isThreadBaseFIlter*/, FALSE /*sendAppDomainEvents*/);

EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
return _URC_FATAL_PHASE1_ERROR;
Expand Down
Loading
Loading