Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Internal.Reflection.Core.Execution;
using System.Diagnostics;
using System.Reflection.Runtime.MethodInfos;
using static System.Reflection.DynamicInvokeInfo;

Expand All @@ -28,47 +29,64 @@ public static ConstructorInvoker Create(ConstructorInfo constructor)
return new ConstructorInvoker(runtimeConstructor);
}

[DebuggerGuidedStepThrough]
public object Invoke()
{
return _methodBaseInvoker.CreateInstanceWithFewArgs(new Span<object?>());
object result = _methodBaseInvoker.CreateInstanceWithFewArgs(new Span<object?>());
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object Invoke(object? arg1)
{
return _methodBaseInvoker.CreateInstanceWithFewArgs(new Span<object?>(ref arg1));
object result = _methodBaseInvoker.CreateInstanceWithFewArgs(new Span<object?>(ref arg1));
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object Invoke(object? arg1, object? arg2)
{
StackAllocatedArguments argStorage = default;
argStorage._args.Set(0, arg1);
argStorage._args.Set(1, arg2);
return _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(2));
object result = _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(2));
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object Invoke(object? arg1, object? arg2, object? arg3)
{
StackAllocatedArguments argStorage = default;
argStorage._args.Set(0, arg1);
argStorage._args.Set(1, arg2);
argStorage._args.Set(2, arg3);
return _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(3));
object result = _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(3));
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object Invoke(object? arg1, object? arg2, object? arg3, object? arg4)
{
StackAllocatedArguments argStorage = default;
argStorage._args.Set(0, arg1);
argStorage._args.Set(1, arg2);
argStorage._args.Set(2, arg3);
argStorage._args.Set(3, arg4);
return _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(4));
object result = _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(4));
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object Invoke(Span<object?> arguments)
{

return _methodBaseInvoker.CreateInstance(arguments);
object result = _methodBaseInvoker.CreateInstance(arguments);
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,23 @@ public static MethodInvoker Create(MethodBase method)
throw new ArgumentException(SR.Argument_MustBeRuntimeMethod, nameof(method));
}

[DebuggerGuidedStepThrough]
public object? Invoke(object? obj)
{
object? result = _methodBaseInvoker.InvokeDirectWithFewArgs(obj, new Span<object?>());
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object? Invoke(object? obj, object? arg1)
{
object? result = _methodBaseInvoker.InvokeDirectWithFewArgs(obj, new Span<object?>(ref arg1));
DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}

[DebuggerGuidedStepThrough]
public object? Invoke(object? obj, object? arg1, object? arg2)
{
StackAllocatedArguments argStorage = default;
Expand All @@ -66,6 +69,7 @@ public static MethodInvoker Create(MethodBase method)
return result;
}

[DebuggerGuidedStepThrough]
public object? Invoke(object? obj, object? arg1, object? arg2, object? arg3)
{
StackAllocatedArguments argStorage = default;
Expand All @@ -78,6 +82,7 @@ public static MethodInvoker Create(MethodBase method)
return result;
}

[DebuggerGuidedStepThrough]
public object? Invoke(object? obj, object? arg1, object? arg2, object? arg3, object? arg4)
{
StackAllocatedArguments argStorage = default;
Expand Down