public SKImage Capture(SKRectI rect) { var tcs = new TaskCompletionSource <SKImage>(); BeginInvokeOnMainThread(() => { try { using (var pool = new NSAutoreleasePool()) { IntPtr imageRef = CGWindowListCreateImage(rect.ToCGRect(), CGWindowListOption.All, 0, CGWindowImageOption.Default); SKImage image = new CGImage(imageRef).ToSKImage(); tcs.SetResult(image); } } catch (Exception ex) { tcs.SetException(ex); } }); return(tcs.Task.Result); }