Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Delete(row) fails with obscure error #2145

Open
RReverser opened this issue Jan 20, 2025 · 0 comments · May be fixed by #2146
Open

.Delete(row) fails with obscure error #2145

RReverser opened this issue Jan 20, 2025 · 0 comments · May be fixed by #2146

Comments

@RReverser
Copy link
Member

Issue from a chat by @SteveBoytsun, creating here for tracking purposes:

using SpacetimeDB;

public static partial class Module
{
    [SpacetimeDB.Table]
    public partial struct A
    {
        [SpacetimeDB.PrimaryKey]
        [SpacetimeDB.AutoInc]
        public int Id;
    }

    [SpacetimeDB.Reducer]
    public static void Test(ReducerContext ctx)
    {
        ctx.Db.A.Insert(new A());
        var val = ctx.Db.A.Iter().First();
        Log.Info(val.Id.ToString());
        ctx.Db.A.Delete(val); // <-- fails
    }
}
PS C:\Users\Steve> spacetime call test Test
Error: Response text: SpacetimeDB. BsatnDecodeException: Couldn't decode the BSATN to the expected type
at SpacetimeDB. Internal. FFI. CheckedStatus.Narshatter.ConvertToNanaged(Errno )
at SpacetimeDB. Internal. , Byte[]
Uint32 , Ulnt32& )
at SpacetimeDB.Internat.ITabteView'2C[SpacetimeDB.Internat.TabIeHand1es.A, StdbModute, Version—I. 9.0.0, Cultu
re=neutrat, PublicKeyToken=nutt], [Module.A, StdbModute, Version—I .0.0.0, Culture—neutral, PubticKeyToken=nuttJ] .
DoDeIete(A )
at SpacetimeDB. Internal. TableHandIes.A. Delete(A )
at Module. TestCReducerContext )
at ModuleRegistration. Test. Invoke(BinaryReader , IReducerContext )
at id, Ulntæ UInt6LJ sender_l, IJInt61.I sender_2,
IJInt6t.l sender_3, IJInt61.l address_O, UInt61.l address_l, DateTimeOffsetRepr timestamp, BytesSource args, BytesSink
error)
RReverser added a commit that referenced this issue Jan 20, 2025
Fixes #2145 found by @SteveBoytsun.

Looks like we didn't have any tests for row deletion directly via table handle (not via index API), so this slipped by.

In this PR I added SDK tests for said API, checked that they fail, and added a fix for C# that now passes.
@RReverser RReverser linked a pull request Jan 20, 2025 that will close this issue
1 task
RReverser added a commit that referenced this issue Jan 21, 2025
Fixes #2145 found by @SteveBoytsun.

Looks like we didn't have any tests for row deletion directly via table handle (not via index API), so this slipped by.

In this PR I added SDK tests for said API, checked that they fail, and added a fix for C# that now passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant