Exemple #1
0
    public static void Out()
    {
        IntPtr handleValue = new IntPtr(3);

        Native.OutCallback callback = (out MyCriticalHandle handle) => handle = null;
        Assert.Throws <MarshalDirectiveException>(() => Native.InvokeOutCallback(callback, ref handleValue));
        GC.KeepAlive(callback);
    }
    public static void Out()
    {
        IntPtr handleValue = new IntPtr(3);

        Native.OutCallback callback = (out MyCriticalHandle handle) => handle = null;
        Assert.Throws <MarshalDirectiveException>(() => Native.InvokeOutCallback(callback, ref handleValue), "Calling P/Invoke that invokes a delegate that has an out CriticalHandle parameter");
        GC.KeepAlive(callback);
    }