diff --git a/src/coreclr/nativeaot/Runtime/thread.cpp b/src/coreclr/nativeaot/Runtime/thread.cpp index cd470e479e388..b84b01f3da860 100644 --- a/src/coreclr/nativeaot/Runtime/thread.cpp +++ b/src/coreclr/nativeaot/Runtime/thread.cpp @@ -1146,7 +1146,7 @@ FORCEINLINE bool Thread::InlineTryFastReversePInvoke(ReversePInvokeFrame * pFram return false; // bad transition } - // this is an ordinary transition to managed code + // This is an ordinary transition to managed code // GC threads should not do that ASSERT(!IsGCSpecial()); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/Common/COMWrappersImpl.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/Common/COMWrappersImpl.cs index f6b7180c299e3..861e0fc85f596 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/Common/COMWrappersImpl.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/Common/COMWrappersImpl.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Runtime.CompilerServices; +using System.Threading; using Xunit; namespace System.Runtime.InteropServices.Tests.Common @@ -39,5 +40,17 @@ protected override object CreateObject(IntPtr externalComObject, CreateObjectFla protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); + + [ModuleInitializer] + internal static void GcStress() + { + var t = new Thread(() => { + var a = new object[1_000_000]; + var r = new Random(); + for (;;) { a[r.Next(a.Length)] = new byte[r.Next(300)]; } + }); + t.IsBackground = true; + t.Start(); + } } }