internal override Bitmap EndGenerate(IAsyncResult asyncResult) { asyncResult.EndDrawInto(); // If there was no exception returning result and clearing the field to prevent disposing. // The caller will take care of disposing if the operation was canceled and the result is discarded. Bitmap bmp = targetBitmap; targetBitmap = null; return(bmp); }