3 comments

  1. I tried DynamicInvoke and that didn’t work either.
    Here is my attempt:

    public class Container
    {
    private void Handler()
    {
    Debugger.Break();
    }
    }

    public App()
    {
    Container c = new Container();
    var handler = c.GetType().GetMethod(“Handler”, BindingFlags.Instance | BindingFlags.NonPublic);
    //throws exeption
    handler.Invoke(c, new object[] { });

    //throws exception
    var d = Delegate.CreateDelegate(typeof(Action), c, “Handler”);
    d.DynamicInvoke();
    }

    Shimmy Beantwoorden

  2. Also, the workaround for private methods is only for static, instance methods are not supported. Any workarounds? Can I grant my apps with some extra trusts for that?

    Shimmy Beantwoorden