diff options
author | Jeremy Koritzinsky <jekoritz@microsoft.com> | 2019-05-06 13:45:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-06 13:45:52 -0700 |
commit | 796776c2c340947fd092ccb9ddab579c41c0fd77 (patch) | |
tree | b09d8a4b301184845f5301809ce23778e257a30e | |
parent | 099177b0899156a4e8a352083a273805240c0ccd (diff) | |
download | coreclr-796776c2c340947fd092ccb9ddab579c41c0fd77.tar.gz coreclr-796776c2c340947fd092ccb9ddab579c41c0fd77.tar.bz2 coreclr-796776c2c340947fd092ccb9ddab579c41c0fd77.zip |
Handle E_NOTIMPL return from CoInitializeEx. (#24387)
* Handle E_NOTIMPL return from CoInitializeEx.
* Remove unneeded STA attributes.
20 files changed, 10 insertions, 18 deletions
diff --git a/src/dlls/mscorrc/mscorrc.rc b/src/dlls/mscorrc/mscorrc.rc index 3576b48b04..f11d48ad9b 100644 --- a/src/dlls/mscorrc/mscorrc.rc +++ b/src/dlls/mscorrc/mscorrc.rc @@ -496,6 +496,7 @@ BEGIN STRINGTABLE DISCARDABLE BEGIN CEE_E_CVTRES_NOT_FOUND "Could not execute CVTRES.EXE." + IDS_EE_THREAD_APARTMENT_NOT_SUPPORTED "The system does not support the %1 thread apartment." IDS_EE_NDIRECT_UNSUPPORTED_SIG "Method's type signature is not PInvoke compatible." IDS_EE_COM_UNSUPPORTED_SIG "Method's type signature is not Interop compatible." IDS_EE_COM_UNSUPPORTED_TYPE "The method returned a COM Variant type that is not Interop compatible." diff --git a/src/dlls/mscorrc/resource.h b/src/dlls/mscorrc/resource.h index 01982d324c..3d92d424b8 100644 --- a/src/dlls/mscorrc/resource.h +++ b/src/dlls/mscorrc/resource.h @@ -723,3 +723,5 @@ #define IDS_EE_BADMARSHAL_COPYCTORRESTRICTION 0x2647 #define IDS_EE_BADMARSHAL_WINRT_COPYCTOR 0x2648 #define IDS_EE_BADMARSHAL_DELEGATE_TLB_INTERFACE 0x2649 +#define IDS_EE_THREAD_APARTMENT_NOT_SUPPORTED 0x264A +
\ No newline at end of file diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index 73d452c0e4..06be462424 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -5092,6 +5092,10 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state, BOOL fFireMDAO { COMPlusThrowOM(); } + else if (hr == E_NOTIMPL) + { + COMPlusThrow(kPlatformNotSupportedException, IDS_EE_THREAD_APARTMENT_NOT_SUPPORTED, (state == AS_InSTA) ? W("STA") : W("MTA")); + } else { _ASSERTE(!"Unexpected HRESULT returned from CoInitializeEx!"); diff --git a/tests/src/JIT/Methodical/eh/deadcode/loopstrswitchgoto.cs b/tests/src/JIT/Methodical/eh/deadcode/loopstrswitchgoto.cs index 8c46521626..4002b08816 100644 --- a/tests/src/JIT/Methodical/eh/deadcode/loopstrswitchgoto.cs +++ b/tests/src/JIT/Methodical/eh/deadcode/loopstrswitchgoto.cs @@ -25,7 +25,7 @@ namespace strswitch s_testLog = new TestUtil.TestLog(expectedOut); } - [STAThread] + private static int Main(string[] args) { string[] s = { "one", "two", "three", "four", "five", "six" }; diff --git a/tests/src/JIT/Methodical/eh/finallyexec/switchincatch.cs b/tests/src/JIT/Methodical/eh/finallyexec/switchincatch.cs index fff8a5ed80..f355396386 100644 --- a/tests/src/JIT/Methodical/eh/finallyexec/switchincatch.cs +++ b/tests/src/JIT/Methodical/eh/finallyexec/switchincatch.cs @@ -41,7 +41,6 @@ namespace strswitch /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { string[] s = { "one", "two", "three", "four", "five", "six" }; diff --git a/tests/src/JIT/Methodical/eh/interactions/gcincatch.cs b/tests/src/JIT/Methodical/eh/interactions/gcincatch.cs index 6f1d5a0ec7..e3594b4826 100644 --- a/tests/src/JIT/Methodical/eh/interactions/gcincatch.cs +++ b/tests/src/JIT/Methodical/eh/interactions/gcincatch.cs @@ -41,7 +41,6 @@ namespace test2 /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] public static int Main(String[] args) { int[] ar = new int[] { 1, 2, 3, 4, 5 }; diff --git a/tests/src/JIT/Methodical/eh/interactions/strswitchfinal.cs b/tests/src/JIT/Methodical/eh/interactions/strswitchfinal.cs index a65594fcdf..cc7b14f774 100644 --- a/tests/src/JIT/Methodical/eh/interactions/strswitchfinal.cs +++ b/tests/src/JIT/Methodical/eh/interactions/strswitchfinal.cs @@ -54,7 +54,7 @@ namespace strswitch s_testLog = new TestUtil.TestLog(expectedOut); } - [STAThread] + private static int Main(string[] args) { string[] s = { "one", "two", "three", "four", "five", "six" }; diff --git a/tests/src/JIT/Methodical/eh/interactions/switchinfinally.cs b/tests/src/JIT/Methodical/eh/interactions/switchinfinally.cs index 388ee9bfdc..547e8894e7 100644 --- a/tests/src/JIT/Methodical/eh/interactions/switchinfinally.cs +++ b/tests/src/JIT/Methodical/eh/interactions/switchinfinally.cs @@ -86,7 +86,6 @@ namespace test3 /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { //Start recording diff --git a/tests/src/JIT/Methodical/eh/regress/asurt/122239/outermostFinally.cs b/tests/src/JIT/Methodical/eh/regress/asurt/122239/outermostFinally.cs index 2e78a257d5..dc5a137e2d 100644 --- a/tests/src/JIT/Methodical/eh/regress/asurt/122239/outermostFinally.cs +++ b/tests/src/JIT/Methodical/eh/regress/asurt/122239/outermostFinally.cs @@ -26,7 +26,7 @@ namespace test // Create and initialize test log object testLog = new TestUtil.TestLog(expectedOut); } - [STAThread] + static int Main(string[] args) { int[] array = { 1, 2, 3, 4, 5, 6 }; diff --git a/tests/src/JIT/Regression/VS-ia64-JIT/M00/b111192/strswitch2.cs b/tests/src/JIT/Regression/VS-ia64-JIT/M00/b111192/strswitch2.cs index 8cc671a2d6..085cd78170 100644 --- a/tests/src/JIT/Regression/VS-ia64-JIT/M00/b111192/strswitch2.cs +++ b/tests/src/JIT/Regression/VS-ia64-JIT/M00/b111192/strswitch2.cs @@ -8,7 +8,6 @@ namespace strswitch { internal class Class1 { - [STAThread] private static int Main(string[] args) { string[] s = { "one", "two", "three", "four", "five", "six" }; diff --git a/tests/src/JIT/Regression/VS-ia64-JIT/M00/b98431/ConsoleApplication2.il b/tests/src/JIT/Regression/VS-ia64-JIT/M00/b98431/ConsoleApplication2.il index 441f3349ab..9d0de900e1 100644 --- a/tests/src/JIT/Regression/VS-ia64-JIT/M00/b98431/ConsoleApplication2.il +++ b/tests/src/JIT/Regression/VS-ia64-JIT/M00/b98431/ConsoleApplication2.il @@ -47,7 +47,6 @@ .method public static int32 Main() cil managed { .entrypoint - .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 2 .locals init (bool V_0, int16 V_1, diff --git a/tests/src/JIT/Regression/VS-ia64-JIT/M00/b99403/cbyte7a.il b/tests/src/JIT/Regression/VS-ia64-JIT/M00/b99403/cbyte7a.il index e4ada33948..2d3b95f110 100644 --- a/tests/src/JIT/Regression/VS-ia64-JIT/M00/b99403/cbyte7a.il +++ b/tests/src/JIT/Regression/VS-ia64-JIT/M00/b99403/cbyte7a.il @@ -47,7 +47,6 @@ .method public static int32 Main() cil managed { .entrypoint - .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 2 .locals init (bool V_0, uint8 V_1) diff --git a/tests/src/Loader/classloader/generics/Variance/Regressions/dev10_468712/dev10_468712.il b/tests/src/Loader/classloader/generics/Variance/Regressions/dev10_468712/dev10_468712.il index 122c60029d..b96f8f0a0b 100644 --- a/tests/src/Loader/classloader/generics/Variance/Regressions/dev10_468712/dev10_468712.il +++ b/tests/src/Loader/classloader/generics/Variance/Regressions/dev10_468712/dev10_468712.il @@ -76,7 +76,6 @@ .method public static int32 Main() cil managed { .entrypoint - .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 1 .locals init ([0] class ConsoleApplicationVB.ICovariant`1<object> y) IL_0000: nop diff --git a/tests/src/Loader/classloader/regressions/91888/pumpFromCctor.cs b/tests/src/Loader/classloader/regressions/91888/pumpFromCctor.cs index 3039771c9e..f1b7f8544c 100644 --- a/tests/src/Loader/classloader/regressions/91888/pumpFromCctor.cs +++ b/tests/src/Loader/classloader/regressions/91888/pumpFromCctor.cs @@ -41,8 +41,6 @@ class Test // post-finalization work to be done. const int maxIterations = 10; - // STA - [STAThread] static int Main() { MyFinalizeObject mfo; diff --git a/tests/src/baseservices/compilerservices/RuntimeHelpers/ExecuteCodeWithGuaranteedCleanup.cs b/tests/src/baseservices/compilerservices/RuntimeHelpers/ExecuteCodeWithGuaranteedCleanup.cs index 58cee3ca36..40b92b715f 100644 --- a/tests/src/baseservices/compilerservices/RuntimeHelpers/ExecuteCodeWithGuaranteedCleanup.cs +++ b/tests/src/baseservices/compilerservices/RuntimeHelpers/ExecuteCodeWithGuaranteedCleanup.cs @@ -40,7 +40,6 @@ namespace GCD /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { GCD gcd = new GCD(); diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs index 9ffe170ec2..a7ce330f31 100644 --- a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs +++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs @@ -15,7 +15,6 @@ namespace Exchange /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { int loops = 100; diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs index 9010b3e762..572435c10a 100644 --- a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs +++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs @@ -16,7 +16,6 @@ namespace Exchange /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { int rValue = 0; diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs index f135e156fb..c645513f52 100644 --- a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs +++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs @@ -16,7 +16,6 @@ namespace Exchange /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { int rValue = 0; diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs index 0811db9469..34bc3357bd 100644 --- a/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs +++ b/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs @@ -15,7 +15,6 @@ namespace Exchange /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { int rValue = 0; diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs index 09fa32a46f..76da18a66d 100644 --- a/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs +++ b/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs @@ -15,7 +15,6 @@ namespace InteropTests /// <summary> /// The main entry point for the application. /// </summary> - [STAThread] static int Main(string[] args) { int rValue = 0; |