-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
area-System.ReflectionenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions
Milestone
Description
dotnet/coreclr#17732 added support for reflection-invoking methods that return unmanaged pointers by reference (so e.g. ref void* Do()), but methods that get them by-reference as their parameters are still pretty broken (so e.g. void Do(ref void* x)).
For example:
using System;
using System.Reflection;
unsafe class Program
{
public static void InvokeMe(out int* pointer)
{
pointer = (int*)0x12345;
}
static void Main(string[] args)
{
typeof(Program).GetMethod(nameof(InvokeMe)).Invoke(null, new object[] { null });
}
}Will crash the runtime with an ExecutionEngineException.
(Note this behavior is on parity with the desktop CLR, so it has quite likely been this broken for 17 years.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.ReflectionenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions