dotnet / dotnet/dotnet-api-docs
`Delegate.DynamicInvokeImpl(Object[])` – can `MemberAccessException` be really thrown by _private method_
Open
area-System.Runtime
Pri3
untriaged
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
From [Exceptions](https://docs.microsoft.com/en-us/dotnet/api/system.delegate.dynamicinvokeimpl?view=net-6.0#exceptions)
> MemberAccessException
The caller does not have access to the method represented by the delegate (for example, if the method is private).
I verified this in C# Interactive (.NET Core) but did not get `MemberAccessException`.
````csharp
> class A { void X() { Write ('X'); } public Delegate Del => X; }
> class B { Delegate x; public B ( Delegate x ) => this.x = x; public void X () => x.DynamicInvoke (); }
> new B(new A().Del).X()
X
````
Am I missing something? Perhaps this statement is only outdated.
Contributor guide
Assessment
This issue has not been assessed yet.