FDB0100: Removed API

Analyzer FoundationDB.Client
Severity Error
Code fix Yes, for renames

Message

'{0}' was removed in version 7. {1}

{0} is the removed name, {1} the replacement from the table below.

Why

Version 7 renamed or restructured several members of the key and directory API. The compiler reports the missing member (CS1061, CS0117, or CS0021) without saying what replaced it. This rule reports at the same place, names the replacement, and offers a code fix when the replacement is a rename.

Receiver Removed name Replacement Code fix
IKeySubspace and its implementations Pack(...), Encode(...) subspace.Key(...) Yes
same EncodeRange(...) subspace.Key(...).ToRange() Yes
same Partition, Partition.ByKey(x) subspace.Key(x).ToSubspace() No
same indexer subspace[a, b], ByKey(a) subspace.Key(a, b) Yes
IFdbDatabase Directory db.Root[...] or db.DirectoryLayer No
IFdbDatabaseProvider, IFdbDatabaseScopeProvider GetDatabaseAsync(ct) GetDatabase(ct), or provider.ReadAsync(...) directly Yes
ISubspaceLocation and its implementations ResolveAsync(tr) Resolve(tr) Yes
KeySelector (static) FirstAfter(k) KeySelector.FirstGreaterThan(k) Yes

Bad

object M(IKeySubspace subspace, int id) => subspace.Pack(id);

Good

object M(IKeySubspace subspace, int id) => subspace.Key(id);

Code fix

The fix renames Pack, Encode, and ByKey to Key, GetDatabaseAsync to GetDatabase, ResolveAsync to Resolve, and FirstAfter to FirstGreaterThan. It rewrites EncodeRange(a) to Key(a).ToRange() and subspace[a, b] to subspace.Key(a, b). Partition and Directory are reported without a fix.

Suppress

#pragma warning disable FDB0100 // reason

or, for a whole project, in .editorconfig:

dotnet_diagnostic.FDB0100.severity = none