You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SyncProgressChangedEventArgs during pull of large files:
• For files where the size in bytes has the 32nd bit set 1, 2,329,488,011 bytes in this case, the progress is negative (from start to finish). See screenshot 1.
• For files where the size in bytes has the 33rd bit set 1, 5,079,805,952 bytes in this case, the progress surpasses 100 at some point. See screenshot 2.
Steps to reproduce the bug
Connect a device
Create a sync service
Pull a large file (as specified) while providing SyncProgressChangedEventArgs callback
Expected behavior
The progress should always be between 0 and 100, as specified.
Also, the TotalBytesToReceive doesn't seem right.
Screenshots
Screenshot 1:
Screenshot 2:
NuGet package version
3.4.14 (later verified in 3.5.15)
.NET Platform
.NET 9
Platform type
Windows
System version
Windows 11 64bit.
The app is only compiled for x64.
In AdvancedSharpAdbClient\Extensions\EnumerableBuilder.cs line 54: Size = ReadInt32(values),.
Generally, stat returns the file size as UInt64, not sure where this FileStatistics data is originally generated.
So this should affect not only pull progress, but also DeviceExtensions.Stat()
Yes, the size you got is incorrect since you lack the 33rd bit:
If the actual size is 4,640,997,376 then the 33rd bit is set 1. If you take it away (by having only 32 bits, you get 346,030,080 instead.
I don't know what happens behind the scenes in the case of AdvancedSharp, but if you run adb shell stat [file name] (in any format), you will get the real size, in this case 4,640,997,376. In other words, pure stat gives the size as UInt64, not UInt32. In your code you get a byte array from somewhere, and you take 32bits for the size, but it is preceded and succeeded by more data, so simply changing it to UInt64 will only take irrelevant info into the size.
So my guess is, it's the thing that gives you the byte array that needs looking into.
Yes, I just looked at this now.
In SyncCommand enum you already have STA2 defined, you just never use it. Can you try Socket.SendSyncRequest(SyncCommand.STA2, remotePath); ? Of course, you will need to adjust the response parsing.
I tried compiling the code myself but I have some 150 errors.
No, the sync v2 has a lot of things. I need to add them all. Also need to add tests for them.
You can get CI packages at here.
(I will push the commit tomorrow so that the commit can count as tomorrow. By the way, I will create a new branch to finnish the sync v2 so that it won't publish to github package...
Activity
Alex4SSB commentedon Jan 6, 2026
In
AdvancedSharpAdbClient\Extensions\EnumerableBuilder.csline 54:Size = ReadInt32(values),.Generally,
statreturns the file size as UInt64, not sure where thisFileStatisticsdata is originally generated.So this should affect not only pull progress, but also
DeviceExtensions.Stat()wherewhere commentedon Jan 7, 2026
Change FileStatistics.Size to uint32 #133
wherewhere commentedon Jan 7, 2026
I have no idea why it returns a wrong size...
Please try it on your device.
Alex4SSB commentedon Jan 7, 2026
Yes, the size you got is incorrect since you lack the 33rd bit:
If the actual size is 4,640,997,376 then the 33rd bit is set
1. If you take it away (by having only 32 bits, you get 346,030,080 instead.I don't know what happens behind the scenes in the case of AdvancedSharp, but if you run
adb shell stat [file name](in any format), you will get the real size, in this case 4,640,997,376. In other words, purestatgives the size as UInt64, not UInt32. In your code you get a byte array from somewhere, and you take 32bits for the size, but it is preceded and succeeded by more data, so simply changing it to UInt64 will only take irrelevant info into the size.So my guess is, it's the thing that gives you the byte array that needs looking into.
wherewhere commentedon Jan 7, 2026
It only have 12 bytes, which 4 bytes per field.
https://github.com/SharpAdb/AdvancedSharpAdbClient/blob/main/AdvancedSharpAdbClient/SyncService.cs#L433-L435
I can't get more bytes because it doesn't have more.
wherewhere commentedon Jan 7, 2026
Structure defined by Google said size is
uint32in stat v1.https://android.googlesource.com/platform/system/adb/+/refs/heads/main/file_sync_service.h
I don't know how to get stat v2.
Alex4SSB commentedon Jan 7, 2026
Yes, I just looked at this now.
In SyncCommand enum you already have STA2 defined, you just never use it. Can you try
Socket.SendSyncRequest(SyncCommand.STA2, remotePath);? Of course, you will need to adjust the response parsing.I tried compiling the code myself but I have some 150 errors.
wherewhere commentedon Jan 8, 2026
Set
FullTargetstofalseto avoid not installed platform.https://github.com/SharpAdb/AdvancedSharpAdbClient/blob/main/Directory.Build.props#L30-L30
wherewhere commentedon Jan 8, 2026
Weird...
wherewhere commentedon Jan 8, 2026
OK. Got it.
Alex4SSB commentedon Jan 8, 2026
Great!
Although the change time looks weird - GTA Vice City was released in 2002...
Also, it probably should be called CreationTime, not ChangeTime
wherewhere commentedon Jan 8, 2026
It said
ctimeis Change Time.https://www.howtogeek.com/517098/linux-file-timestamps-explained-atime-mtime-and-ctime/#:~:text=Every%20Linux%20file%20has%20three%20timestamps%3A%20the%20access,the%20file%20or%20read%20some%20values%20from%20it.
1996 is because the file has wrong change time.
Alex4SSB commentedon Jan 8, 2026
Ok, can you release a new version with the fix please?
wherewhere commentedon Jan 8, 2026
No, the sync v2 has a lot of things. I need to add them all. Also need to add tests for them.
You can get CI packages at here.
(I will push the commit tomorrow so that the commit can count as tomorrow. By the way, I will create a new branch to finnish the sync v2 so that it won't publish to github package...
Add stat v2 and list v2 #133
wherewhere commentedon Jan 13, 2026
Published https://github.com/SharpAdb/AdvancedSharpAdbClient/releases/tag/v3.6.16