{"record":{"id":"efa3c52f7fcd5ed6","repo":"tursodatabase/turso","slug":"partial-sync-on-windows-requires-native-sparse-fil","errorCode":null,"errorMessage":"Partial sync on Windows requires native sparse-file hole detection that is not yet implemented.","messagePattern":"Partial sync on Windows requires native sparse-file hole detection that is not yet implemented\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoSyncDatabaseOptions.cs","lineNumber":191,"sourceCode":"                $\"Long-poll timeout must be between 1 and {int.MaxValue} milliseconds.\");\n        }\n\n        ValidateNativeSize(PushOperationsThreshold, nameof(PushOperationsThreshold));\n        ValidateNativeSize(PullBytesThreshold, nameof(PullBytesThreshold));\n        PartialSync?.Validate();\n\n        if (PartialSync is not null && !BootstrapIfEmpty)\n            throw new InvalidOperationException(\"Partial sync requires BootstrapIfEmpty=True.\");\n        if (PartialSync is not null && RemoteEncryption is not null)\n            throw new InvalidOperationException(\"Partial sync cannot be combined with remote encryption.\");\n        if (PartialSync?.Query is not null && PullBytesThreshold.HasValue)\n        {\n            throw new InvalidOperationException(\n                \"PullBytesThreshold cannot be combined with query partial bootstrap.\");\n        }\n        if (PartialSync is not null && OperatingSystem.IsWindows())\n        {\n            throw new PlatformNotSupportedException(\n                \"Partial sync on Windows requires native sparse-file hole detection that is not yet implemented.\");\n        }\n\n        RemoteEncryption?.Validate();\n    }\n\n    private static void ValidateNativeSize(long? value, string parameterName)\n    {\n        if (value is null)\n            return;\n        if (value <= 0)\n            throw new ArgumentOutOfRangeException(parameterName, value, \"The value must be positive.\");\n        if ((ulong)value > nuint.MaxValue)\n            throw new ArgumentOutOfRangeException(parameterName, value, \"The value exceeds the native platform size.\");\n    }\n}\n\npublic sealed record TursoSyncStats(","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/tursodatabase/turso/blob/c1e59287258d99b309e362a63f48822256e2f65f/bindings/dotnet/src/Turso.Data/TursoSyncDatabaseOptions.cs#L173-L209","documentation":"Validate refuses PartialSync on Windows. Partial sync creates sparse files with holes for unpulled segments and relies on native sparse-file hole detection that is not implemented on Windows, so the feature is explicitly unsupported there and throws PlatformNotSupportedException.","triggerScenarios":"Constructing TursoSyncDatabase with PartialSync set while running on any Windows platform (OperatingSystem.IsWindows() true at TursoSyncDatabaseOptions.cs:189-193).","commonSituations":"Deploying a partial-sync-based .NET service to Windows containers or Windows Server, developing on a Windows workstation with a config copied from a Linux colleague, CI matrix running the same sync code on windows-latest runners.","solutions":["Run the sync workload on Linux or macOS, or move it to a Linux container.","Remove PartialSync on Windows and use full sync (default) instead.","Branch configuration at startup on OperatingSystem.IsWindows() so Windows deployments fall back to full sync."],"exampleFix":"// before\nvar opts = new TursoSyncDatabaseOptions(path, uri) { PartialSync = new() { PrefixLength = 100 } };\n// after\nvar opts = OperatingSystem.IsWindows()\n    ? new TursoSyncDatabaseOptions(path, uri)\n    : new TursoSyncDatabaseOptions(path, uri) { PartialSync = new() { PrefixLength = 100 } };","handlingStrategy":"fallback","validationCode":"static bool PartialSyncSupportedOnThisOs() => !OperatingSystem.IsWindows();\n// at config time:\nvar partialSync = OperatingSystem.IsWindows() ? null : new TursoPartialSyncOptions { PrefixLength = 100 };","typeGuard":"static bool CanUsePartialSync() => !OperatingSystem.IsWindows();","tryCatchPattern":"try { var db = new TursoSyncDatabase(opts); }\ncatch (PlatformNotSupportedException ex) when (ex.Message.Contains(\"Partial sync on Windows\"))\n{\n    // rebuild options without PartialSync and retry\n}","preventionTips":["Gate PartialSync behind an OS check (OperatingSystem.IsWindows()) at configuration time.","Use full sync on Windows deployments and containers; restrict partial sync to Linux/macOS hosts.","Add a windows-latest CI job that exercises your sync-options factory to catch the platform mismatch early."],"tags":["dotnet","sync","partial-sync","windows","platform-not-supported"],"backgroundTag":"unsupported-platform","analyzedSha":"c1e59287258d99b309e362a63f48822256e2f65f","analyzedAt":"2026-08-31T11:17:35.598Z","contentChangedAt":"2026-08-31T11:17:35.598Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}