Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ce291b4

Browse files
committed
Prevent ngen Array.Sort short circuit
1 parent 127e9e8 commit ce291b4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/mscorlib/src/System/Internal.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ static void CommonlyUsedGenericInstantiations()
5959
// Note that reference type instantiations are already included
6060
// automatically for us.
6161

62-
Array.Sort<double>(Array.Empty<double>());
63-
Array.Sort<int>(Array.Empty<int>());
64-
Array.Sort<IntPtr>(Array.Empty<IntPtr>());
62+
// Need to sort non null, len > 1 array or paths will short-circuit
63+
Array.Sort<double>(new double[1]);
64+
Array.Sort<int>(new int[1]);
65+
Array.Sort<IntPtr>(new IntPtr[1]);
6566

6667
new ArraySegment<byte>(new byte[1], 0, 0);
6768

0 commit comments

Comments
 (0)