Home > database >  C# AdvancedSharpAdbClient Screenshot returns an error
C# AdvancedSharpAdbClient Screenshot returns an error

Time:01-17

I'm using AdvancedSharpAdbClient, and I'm trying to take a screenshot of the device's screen and have it return to the program as an image, but for whatever reason it errors, even those I'm using the same as used in the documentation here:

private static AdbClient client = new AdbClient();
public Bitmap Screenshot()
{
    Image i = client.GetFrameBufferAsync(device, CancellationToken.None).GetAwaiter().GetResult();
    return (Bitmap)i;
}

I get the below error when I call this method:

System.ArgumentException( The buffer is not associated with this pool and may not be returned to it. (Parameter 'array') )

CodePudding user response:

The issue is known and someone already provided a fix, check these links:

https://github.com/yungd1plomat/AdvancedSharpAdbClient/issues/29 https://github.com/yungd1plomat/AdvancedSharpAdbClient/pull/35

Here is a link to the fixed version: https://github.com/ilamp/AdvancedSharpAdbClient

The error didn't happen for me anymore when I used this version. Good luck!

  • Related