Skip to content

Commit

Permalink
Try to repro dotnet#85377 in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas committed Apr 26, 2023
1 parent 9f07f65 commit d8acbb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Collections;
using System.Runtime.CompilerServices;
using System.Threading;
using Xunit;

namespace System.Runtime.InteropServices.Tests.Common
Expand Down Expand Up @@ -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();
}
}
}

0 comments on commit d8acbb5

Please sign in to comment.