Add a SpacetimeDBException to C# SDK to aid in debugging#3386
Merged
Add a SpacetimeDBException to C# SDK to aid in debugging#3386
Conversation
Contributor
|
Some missing or dangling .meta found. Fix commits are needed.
|
1 task
…'origin/bfops/fix-csharp-quickstart-smoketest' into rekhoff/custom-csharp-sdk-exceptions
…'origin/master' into rekhoff/custom-csharp-sdk-exceptions
…'origin/master' into rekhoff/custom-csharp-sdk-exceptions
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 23, 2025
# Description of Changes The quickstart smoketest was not correctly fudging our NuGet dependencies to use the local versions of the packages, so it was pulling them from NuGet. This ended up causing issues when we tried to modify local packages and then use them in a way that affected the quickstart (e.g. #3386). We had a few issues: we weren't ensuring that the local packages were built, we weren't using the right directory for those packages, and we weren't adding a "package source mapping" that forced those packages to be used from the local directory. # API and ABI breaking changes None. CI-only. # Expected complexity level and risk 2 # Testing - [x] CI passes when #3386 is merged together with this PR (it wasn't before). --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
…'origin/master' into rekhoff/custom-csharp-sdk-exceptions
…'origin/master' into rekhoff/custom-csharp-sdk-exceptions
jdetter
reviewed
Oct 24, 2025
sdks/csharp/examples~/regression-tests/republishing/client/client.csproj
Show resolved
Hide resolved
jdetter
approved these changes
Oct 24, 2025
Collaborator
jdetter
left a comment
There was a problem hiding this comment.
Haven't tested this myself but I was involved in the early testing of this PR and also this is quite simple. LGTM 👍
bfops
added a commit
that referenced
this pull request
Nov 3, 2025
# Description of Changes This implements a fix to an issue with debugging using the C# SDK, by adding new exception types: * `SpacetimeDBException`, * `SpacetimeDBArgumentException`, * `SpacetimeDBEmptyReducerNameException` Additional, regenerating bindings will now allow clients to report an `SpacetimeDBEmptyReducerNameException` rather than an `ArgumentOutOfRangeException` when the client receives an empty reducer name from the server. An example of the generated code currently, that results in the exception: https://github.com/clockworklabs/SpacetimeDB/blob/544e2edc2d1f7d1dd118832a815b6dbd7a6c1d82/sdks/csharp/examples~/quickstart-chat/client/module_bindings/SpacetimeDBClient.g.cs#L475 Note: Normally this is not an issue for a client, because the `SpacetimeDBEmptyReducerNameException` would be caught by the [Try/Catch](https://github.com/clockworklabs/SpacetimeDB/blob/9f59118e24449cdd2d3e182bd44fdb26078e921b/sdks/csharp/src/SpacetimeDBClient.cs#L421C25-L421C42) statement, but a debugger will still catch the exception and halt operation. This can be annoying to a developer when debugging. By separating out the exception into a custom `Exception` type, we allow a developer to flag the new exception type as something it can ignore, without ignoring other relevant exceptions. # API and ABI breaking changes Not a breaking change. Clients will need to regenerate bindings to get the new exceptions # Expected complexity level and risk 1 # Testing - [X] Tested regenerating bindings and confirmed intended output. - [X] Tested debugging and receiving `SpacetimeDBEmptyReducerNameException` when expected. --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
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.
Description of Changes
This implements a fix to an issue with debugging using the C# SDK, by adding new exception types:
SpacetimeDBException,SpacetimeDBArgumentException,SpacetimeDBEmptyReducerNameExceptionAdditional, regenerating bindings will now allow clients to report an
SpacetimeDBEmptyReducerNameExceptionrather than anArgumentOutOfRangeExceptionwhen the client receives an empty reducer name from the server.An example of the generated code currently, that results in the exception:
SpacetimeDB/sdks/csharp/examples~/quickstart-chat/client/module_bindings/SpacetimeDBClient.g.cs
Line 475 in 544e2ed
Note: Normally this is not an issue for a client, because the
SpacetimeDBEmptyReducerNameExceptionwould be caught by the Try/Catch statement, but a debugger will still catch the exception and halt operation. This can be annoying to a developer when debugging.By separating out the exception into a custom
Exceptiontype, we allow a developer to flag the new exception type as something it can ignore, without ignoring other relevant exceptions.API and ABI breaking changes
Not a breaking change.
Clients will need to regenerate bindings to get the new exceptions
Expected complexity level and risk
1
Testing
SpacetimeDBEmptyReducerNameExceptionwhen expected.