Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShellCommandUnresponsiveException while DumpScreenAsync #55

Closed
RAREGUN opened this issue May 26, 2023 · 7 comments · Fixed by #68
Closed

ShellCommandUnresponsiveException while DumpScreenAsync #55

RAREGUN opened this issue May 26, 2023 · 7 comments · Fixed by #68
Labels
bug Something isn't working

Comments

@RAREGUN
Copy link

RAREGUN commented May 26, 2023

Describe the bug

Getting this exception only while this screen (Look screenshots section).
I think that the timer is to blame for everything, because when it expires, the exception stops appearing.
The worst part of all this is that after getting this exception at least once, it most likely breaks something and I get this exception regardless of whether I closed this page with a timer or not.

I'm using virtual machine with android 9.
App on screenshot: Official Telegram mobile client

System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at AdvancedSharpAdbClient.AdbClient.DumpScreenAsync(DeviceData device, CancellationToken cancellationToken)

Steps to reproduce the bug

Try to DumpScreenAsync while "Enter code" page.
This is very complicated to reproduce this bug by yourself, it's costs 0.34$ each time :)
But I'm all yours.

Expected behavior

No response

Screenshots

image

NuGet package version

2.5.5

.NET Platform

.NET 7

Platform type

Windows

System version

Windows 11 Pro 22H2 22621.1413

IDE

Other

Additional context

No response

@RAREGUN RAREGUN added the bug Something isn't working label May 26, 2023
@RAREGUN
Copy link
Author

RAREGUN commented May 26, 2023

I tried to inject logger to DumpScreenAsync like this:
image
And logs i got:
image

  1. When we are trying to dump timer page first time.
  2. Idk...
  3. When timer page has gone and we are looking at dumpable page, but not now because of exception before

@wherewhere
Copy link
Member

wherewhere commented May 26, 2023

I can get xml on my device. I don't know what's going on. Could you try to debug it with source step by step?
image
Also when while.
image
I think it is an error of adb. Because it should not return a java error...

@wherewhere
Copy link
Member

wherewhere commented May 26, 2023

I can only add check to java.lang.Exception
image

@RAREGUN
Copy link
Author

RAREGUN commented May 28, 2023

Sorry my mistake, Polly.Policy.TimeoutAsync didn't throw a TimeoutRejectedException when time ran out and the while (!cancellationToken.IsCancellationRequested) loop inside FindElementsAsync method kept spinning forever causing a "bruteforce attack" on the ADB server

@RAREGUN RAREGUN closed this as completed May 28, 2023
@RAREGUN
Copy link
Author

RAREGUN commented Jun 8, 2023

I made a mistake again. The issue is still present, but the error now is ERROR: could not get idle state.. It appears only when the timer is running. What does this error mean and how to avoid?

@RAREGUN RAREGUN reopened this Jun 8, 2023
@wherewhere
Copy link
Member

wherewhere commented Jun 9, 2023

This is a error report by adb. You should ask to Google...
(I don't know what are you talking about...
The timer is which timer...

@phuongbk90
Copy link

I made a mistake again. The issue is still present, but the error now is ERROR: could not get idle state.. It appears only when the timer is running. What does this error mean and how to avoid?

Hi, You should use below repo to dump screen.
https://github.com/dtmilano/CulebraTester2-public

Default uiautomator by google is limitation and you can only dump static screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants