Exemplo n.º 1
0
    public static void Ret()
    {
        IntPtr handleValue = new IntPtr(2);

        Native.RetCallback callback = () => new MyCriticalHandle();
        Assert.Throws <MarshalDirectiveException>(() => Native.InvokeRetCallback(callback));
        GC.KeepAlive(callback);
    }
    public static void Ret()
    {
        IntPtr handleValue = new IntPtr(2);

        Native.RetCallback callback = () => new MyCriticalHandle();
        Assert.Throws <MarshalDirectiveException>(() => Native.InvokeRetCallback(callback), "Calling P/Invoke that invokes a delegate that returns a CriticalHandle parameter");
        GC.KeepAlive(callback);
    }