Skip to content

[wasm][coreclr] Attempt to access method System.Delegate.DelegateConstruct results in exception #121955

@radekdoulik

Description

@radekdoulik

Repro:

using System;
using System.Collections.Generic;

try
{
    GCMemoryInfo memoryInfoInvalid = GC.GetGCMemoryInfo((GCKind)(-1));
}
catch (Exception e)
{   
    Console.WriteLine("caught arg exception as expected: {0}", e);
}

Output:

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

Unhandled exception. System.MethodAccessException: Attempt by method 'System.Buffers.SharedArrayPool`1<T>.InitializeTlsBucketsAndTrimming()' to access method 'System.Delegate.DelegateConstruct(System.Object, IntPtr)' failed.
   at System.Buffers.SharedArrayPool`1.InitializeTlsBucketsAndTrimming() in /Users/rodo/git/runtime-main/src/libraries/System.Private.CoreLib/src/System/Buffers/SharedArrayPool.cs:line 288
   at System.Buffers.SharedArrayPool`1.Return(T[] array, Boolean clearArray) in /Users/rodo/git/runtime-main/src/libraries/System.Private.CoreLib/src/System/Buffers/SharedArrayPool.cs:line 136
   at System.IO.StreamWriter.WriteFormatHelper(String format, ReadOnlySpan`1 args, Boolean appendNewLine) in /Users/rodo/git/runtime-main/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs:line 515
   at System.IO.StreamWriter.WriteLine(String format, Object arg0) in /Users/rodo/git/runtime-main/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs:line 593
   at System.Console.WriteLine(String format, Object arg0) in /Users/rodo/git/runtime-main/src/libraries/System.Console/src/System/Console.cs:line 829
   at Program.<Main>$(String[] args) in /Users/rodo/git/HelloWorld/Program.cs:line 10
Aborted(native code called abort())

This is also happening in runtime tests, 88 times in the last run

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions