feat: .NET SDK update for version 5.0.0#97
Conversation
Greptile SummaryThis PR updates the .NET SDK from version 4.2.0 to 5.0.0, adding new services, models, and enums while removing deprecated ones and introducing several breaking changes.
Confidence Score: 5/5The functional changes are safe and internally consistent; the only gap is incomplete changelog coverage of three compile-time-breaking enum renames. All model, service, and enum changes follow existing SDK conventions correctly. Constructor parameters, From() factories, and ToMap() methods are updated in lock-step across every affected model. The pre-existing Presence.metadata ToString() issue was flagged in a prior review. The one gap found here is that three breaking enum renames (Scopes, Theme, Name) are absent from the CHANGELOG Breaking section, which could surprise consumers upgrading from 4.x but does not affect runtime correctness. CHANGELOG.md — three compile-time-breaking enum renames should be listed in the Breaking section alongside the existing entries. Important Files Changed
Reviews (3): Last reviewed commit: "chore: merge main and resolve version co..." | Re-trigger Greptile |
| case "bytes": | ||
| buffer = ((byte[])input.Data) | ||
| .Skip((int)offset) | ||
| .Take((int)Math.Min(size - offset, ChunkSize - 1)) | ||
| .ToArray(); | ||
| Buffer.BlockCopy((byte[])input.Data, (int)start, chunk, 0, length); | ||
| break; |
There was a problem hiding this comment.
The
bytes case casts start (a long) to int before passing it as the srcOffset to Buffer.BlockCopy. For byte arrays whose size is close to or above int.MaxValue (~2 GB), the cast will silently overflow and copy from the wrong position, corrupting the upload. The other two source cases handle large offsets correctly via chunkStream.Seek(start, ...) and arithmetic on long.
| case "bytes": | |
| buffer = ((byte[])input.Data) | |
| .Skip((int)offset) | |
| .Take((int)Math.Min(size - offset, ChunkSize - 1)) | |
| .ToArray(); | |
| Buffer.BlockCopy((byte[])input.Data, (int)start, chunk, 0, length); | |
| break; | |
| case "bytes": | |
| checked { Buffer.BlockCopy((byte[])input.Data, (int)start, chunk, 0, length); } | |
| break; |
| if (index == 0) | ||
| { | ||
| uploadId = chunkResult.ContainsKey("$id") | ||
| ? chunkResult["$id"]?.ToString() ?? string.Empty | ||
| : string.Empty; | ||
| } |
There was a problem hiding this comment.
index == 0 branch inside workers is dead code
uploadId is captured by the closure and written here when index == 0. In every execution path that reaches the concurrent workers, chunk index 0 has already been uploaded in the serial if (offset == 0) block, so this branch can never execute inside the workers. Leaving it in place is misleading and could silently introduce a race if the chunk-building logic is ever changed.
| metadata: map.TryGetValue("metadata", out var additionalPropsValue) | ||
| ? (Dictionary<string, object>)additionalPropsValue | ||
| : map | ||
| metadata: map.TryGetValue("metadata", out var metadata) ? metadata?.ToString() : null |
There was a problem hiding this comment.
Structured metadata is silently destroyed
metadata?.ToString() is called on the value coming out of ObjectToInferredTypesConverter, which deserializes JSON objects into Dictionary<string, object?>. Calling .ToString() on a dictionary returns the type name, not the content. Any presence record whose metadata field is a JSON object will surface as a garbage string instead of the original structured data.
This PR contains updates to the .NET SDK for version 5.0.0.