I want to take a screenshot and then perform a OCRrequest to Google Cloud Vision in C#. Currently I am having problems in the part of taking the screenshot. Locally it works, but in zapworks I recieve next error “An abnormal situation has occurred: the PlayerLoop internal function has been called recursively”. Is there a suggested way of of taking a screenshot that works in zapworks? My code is as follows:
public async Task TakeScreenshotAsync()
{
string filename = "screenshot.png";
ScreenCapture.CaptureScreenshot(filename);
// Wait for the screenshot to be saved
Thread.Sleep(500);
// Read the saved screenshot file
byte[] bytes = File.ReadAllBytes(filename);
// await SendOCRRequest(bytes);
}