When I was trying to replicate a test failure I run into this issue. The repro source code:
using System;
using System.Collections.Generic;
try
{
    GCMemoryInfo memoryInfoInvalid = GC.GetGCMemoryInfo((GCKind)(-1));
}
catch (Exception e)
{
    if (e is ArgumentOutOfRangeException)
        Console.WriteLine("caught arg exception as expected: {0}", e);
}
The assert:
caught arg exception as expected: System.ArgumentOutOfRangeException: Argument must be between Any and Background. (Parameter 'kind')
   at System.GC.GetGCMemoryInfo(GCKind kind) in /Users/rodo/git/runtime-main/src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs:line 77
   at Program.<Main>$(String[] args) in /Users/rodo/git/HelloWorld/Program.cs:line 6
warning: unsupported syscall: __syscall_madvise
Assert failure(PID 42 [0x0000002a], Thread: 1 [0x0001]): did not expect to collide with a 1st-pass ExInfo during a EH stackwalk
    File: /Users/rodo/git/runtime-main/src/coreclr/vm/exceptionhandling.cpp:4111
    Image: /managed
@janvorli please take a look