Repository navigation
fix: read Android's dropped connection as Offline, and apply nothing when a values request fails - #9
Merged
Conversation
…when a values request fails AndroidMessageHandler reports a dropped connection as WebException (inner Java.Net.SocketException: Software caused connection abort), not HttpRequestException. FreedomApi only caught the latter, so on the Register tablet on 2026-10-04 a connection dropped as the app was backgrounded escaped SyncAsync from the values request instead of returning Offline. - FreedomApi treats WebException and IOException as no answer, alongside HttpRequestException and an unrequested timeout. No Android types are referenced; both are BCL. - A values request that gets no answer or an error now abandons the whole sync: nothing is applied, not earlier batches nor removals, so the store stays exactly what its ETag describes and the next start retries cleanly. It is reported as the manifest request would have been (Offline, ServerError, ...), where before it came back UpToDate or Updated.
crazeydave
added a commit
to bleedingdeacons/register
that referenced
this pull request
Oct 5, 2026
… not an unobserved exception (#62) On 2026-10-04 the tablet was backgrounded during the startup sync. Android's handler threw WebException, which Freedom.Client 0.1.1 did not recognise, and it escaped FreedomClient.SyncAsync as "Unobserved exception in fire-and-forget task (FreedomStartupSync)". freedom-sharp 0.2.1 (bleedingdeacons/freedom-sharp#9) reads it as no answer, reports Offline, and applies nothing when a values request fails, so the next start retries cleanly. Also takes 0.2.0, which builds Freedom.Client.Maui for every head; Register still references it on Android only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found on the Register tablet on 2026-10-04, in the app log under
files/logs. The app was backgrounded mid-sync, the connection dropped, and the start surfaced as "Unobserved exception in fire-and-forget task (FreedomStartupSync)" instead of aSyncResultwith statusOffline. The next sync succeeded.AndroidMessageHandlerdoes not throwHttpRequestException. It throwsSystem.Net.WebException(innerJava.Net.SocketException: Software caused connection abort).FreedomApi.SendAsynconly caughtHttpRequestExceptionand an unrequestedTaskCanceledException, so the exception escapedSyncAsync→ApplyManifestAsync→SendAsync<ValuesResponse>.The fix:
FreedomApitreatsWebExceptionandIOExceptionas no answer, alongside the two it already caught. Reads retry as before; the response isUnreachable. Both are BCL types, soFreedom.Clientstays plainnet10.0with no Android reference. A caller's own cancellation is still not mistaken for no network.Offlinefor no answer andServerErrorfor a 5xx or 429. A 401 or a plugin refusal on the values request clears the device, exactly as it would on the manifest. Before, the start came backUpToDateorUpdatedwith a "partly updated" message, which theServerErrorcase inStartupSync.featurenever checked.Tests:
FakeFreedomServer.ValuesFailureandConnectionAborted()reproduce the exception Android's handler throws.FreedomApiTestschecksWebExceptionandIOExceptionon a read (retried) and on a write (not retried), and that a caller's own cancellation still throws.FreedomClientTestschecks three things:VerifiedAtuntouched, raises noConfigChanged, and the next start repairs it;ServerError.Offline.featurehas a new rule for a connection lost part-way through a start, with two scenarios.StartupSync.featurenow assertsServerErrorfor its existing scenario where the values could not be fetched.Against the client code before this change, 5 of the new tests and 3 scenarios fail. With it: 86 tests pass, and 36 scenarios pass with 6 manual ones skipped.
dotnet format --verify-no-changesis clean for all four projects. The MAUI project is untouched.