summaryrefslogtreecommitdiff
path: root/src/vm/assembly.cpp
diff options
context:
space:
mode:
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>2017-12-28 16:35:12 -0800
committerJan Kotas <jkotas@microsoft.com>2017-12-28 16:35:12 -0800
commit31e22b200de37bd8005c650c90e2098e42201eec (patch)
tree8258b6a16d353d1bafa176cab4f8b95e0010dc57 /src/vm/assembly.cpp
parent09ab9723fd6a05a57685137ccb795680d975693d (diff)
downloadcoreclr-31e22b200de37bd8005c650c90e2098e42201eec.tar.gz
coreclr-31e22b200de37bd8005c650c90e2098e42201eec.tar.bz2
coreclr-31e22b200de37bd8005c650c90e2098e42201eec.zip
Recognize STA\MTA Attribute For Main Function (#15652)
* Apartment state set for main method * g_fWeownprocess removed and CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_FinalizeOnShutdown) set
Diffstat (limited to 'src/vm/assembly.cpp')
-rw-r--r--src/vm/assembly.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp
index 32a7cd9969..e93d2c3466 100644
--- a/src/vm/assembly.cpp
+++ b/src/vm/assembly.cpp
@@ -1790,7 +1790,22 @@ INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs, BOOL waitForOtherThre
GCX_COOP();
pMeth = GetEntryPoint();
+
if (pMeth) {
+ {
+#ifdef FEATURE_COMINTEROP
+ GCX_PREEMP();
+
+ Thread::ApartmentState state = Thread::AS_Unknown;
+ state = SystemDomain::GetEntryPointThreadAptState(pMeth->GetMDImport(), pMeth->GetMemberDef());
+
+ // If the entry point has an explicit thread apartment state, set it
+ // before running the AppDomainManager initialization code.
+ if (state == Thread::AS_InSTA || state == Thread::AS_InMTA)
+ SystemDomain::SetThreadAptState(state);
+#endif // FEATURE_COMINTEROP
+ }
+
RunMainPre();