{"record":{"id":"d2b51c64f745745c","repo":"tursodatabase/turso","slug":"embedded-replica-sync-is-not-supported-yet-by-the","errorCode":null,"errorMessage":"Embedded replica sync is not supported yet by the .NET provider.","messagePattern":"Embedded replica sync is not supported yet by the \\.NET provider\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnection.cs","lineNumber":162,"sourceCode":"        return command.ExecuteNonQuery();\n    }\n\n    public void Sync()\n    {\n        SyncAsync(CancellationToken.None).GetAwaiter().GetResult();\n    }\n\n    public Task SyncAsync(CancellationToken cancellationToken = default)\n    {\n        ObjectDisposedException.ThrowIf(_disposed, this);\n        if (cancellationToken.IsCancellationRequested)\n            return Task.FromCanceled(cancellationToken);\n        if (State != ConnectionState.Open)\n            throw new InvalidOperationException(\"Turso database is closed.\");\n        if (!_connectionOptions.IsReplica)\n            throw new NotSupportedException(\"Sync requires an embedded replica connection.\");\n\n        throw new NotSupportedException(\"Embedded replica sync is not supported yet by the .NET provider.\");\n    }\n\n    public override void ChangeDatabase(string databaseName)\n    {\n        throw new NotSupportedException(\"Turso does not support changing the active database.\");\n    }\n\n    internal int DefaultTimeout => _connectionOptions.DefaultTimeout;\n\n    internal bool IsRemote => _remoteClient is not null;\n\n    internal bool ReadUncommitted\n    {\n        get => _readUncommitted;\n        set => _readUncommitted = value;\n    }\n\n    internal TursoDatabaseHandle Turso => _turso ?? throw new InvalidOperationException(\"Turso database is closed.\");","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoConnection.cs#L144-L180","documentation":"The terminal guard in SyncAsync: even when the connection is open and configured as an embedded replica, the .NET provider has not implemented replica synchronization, so every successful pre-check ends here with NotSupportedException. In practice OpenRemote() refuses to open replica connections at all, so this line exists to keep the public API honest if state ever changes.","triggerScenarios":"Any Sync()/SyncAsync() call on a connection whose options have IsReplica == true (remote Data Source plus non-empty Replica Path); periodic-sync loops ported from Turso's Rust/Python/JS bindings.","commonSituations":"Following Turso docs written for other language bindings; polyglot repos sharing one replica workflow across providers; upgrading from a native-wrapper package to this provider and keeping the sync timer.","solutions":["Do not call Sync in the .NET provider: drop 'Replica Path' and use a direct remote URL so commands execute on the server directly","If offline/embedded-replica semantics are required, use a binding that implements them (Rust core, Python, JS) until .NET support ships","Track the provider's roadmap and re-introduce sync calls only after embedded replicas are supported"],"exampleFix":"// before\nvar cs = \"Data Source=libsql://db.turso.io;Auth Token=...;Replica Path=local.db\";\nusing var conn = new TursoConnection(cs);\nconn.Open();\nawait conn.SyncAsync(); // NotSupportedException\n\n// after\nvar cs = \"Data Source=libsql://db.turso.io;Auth Token=...\";\nusing var conn = new TursoConnection(cs);\nconn.Open();\n// direct remote: no sync step exists or is needed","handlingStrategy":"validation","validationCode":"var opts = TursoConnectionOptions.Parse(cs);\nif (opts.IsReplica)\n{\n    throw new ConfigurationException(\n        \"The .NET Turso provider does not support embedded replica sync; use a direct remote URL.\");\n}","typeGuard":null,"tryCatchPattern":"try { await conn.SyncAsync(ct); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Embedded replica sync\"))\n{\n    // provider limitation: log and continue without sync\n}","preventionTips":["Grep codebases ported from other SDKs for Sync/SyncAsync before shipping on .NET","Keep replica keywords out of .NET connection strings","Watch provider release notes for embedded replica support"],"tags":["csharp","dotnet","turso","embedded-replica","not-supported"],"backgroundTag":"unsupported-feature-provider","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}