{"record":{"id":"89224cae7bb93589","repo":"clockworklabs/SpacetimeDB","slug":"unsupported-type-type","errorCode":null,"errorMessage":"Unsupported type {type}","messagePattern":"Unsupported type (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"crates/bindings-csharp/BSATN.Codegen/Type.cs","lineNumber":113,"sourceCode":"                    typeInfo,\n                    Parse(member, named.TypeArguments[0], diag),\n                    Parse(member, named.TypeArguments[1], diag)\n                ),\n                \"System.Collections.Generic.List<T>\" => new ListUse(\n                    type,\n                    typeInfo,\n                    Parse(member, named.TypeArguments[0], diag)\n                ),\n                \"System.Nullable<T>\" => new NullableUse(type, typeInfo),\n                _ => named.IsValueType\n                    ? (\n                        named.TypeKind == Microsoft.CodeAnalysis.TypeKind.Enum\n                            ? new EnumUse(type, typeInfo)\n                            : new ValueUse(type, typeInfo)\n                    )\n                    : new ReferenceUse(type, typeInfo),\n            },\n            _ => throw new InvalidOperationException($\"Unsupported type {type}\"),\n        };\n    }\n\n    /// <summary>\n    /// Get the name of the BSATN struct for this type.\n    /// </summary>\n    public virtual string ToBSATNString()\n    {\n        return this.BSATNName;\n    }\n\n    public virtual string ToBSATNString2()\n    {\n        return this.BSATNName;\n    }\n\n    /// <summary>\n    /// Get a statement that declares outVar and assigns (inVar1 logically-equals inVar2) to it.","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-csharp/BSATN.Codegen/Type.cs#L95-L131","documentation":"TypeUse.Parse inside the BSATN C# source generator maps a Roslyn type symbol to a BSATN type node. It understands arrays, named types (including Nullable<T>), type parameters, enums and value/reference types; the final `_` arm throws InvalidOperationException for symbol kinds it cannot map — pointer types, function pointers, `dynamic`, and similar non-array/non-named symbols.","triggerScenarios":"A table row type, reducer parameter, or [SpacetimeDB.Type]-annotated member in a C# client uses an unmappable type: pointer fields (byte*), function pointers (delegate*<void>), dynamic, or interop-style types carrying unsafe members.","commonSituations":"Copy-pasting OS-interop or native-struct types into module schema types; unsafe code blocks leaking into row definitions; porting structs from P/Invoke projects.","solutions":["Replace the offending type with a BSATN-supported one — the message names the exact symbol that failed","Store fixed binary data as byte[] instead of pointers","Restrict schema types to: primitives, string, byte[], arrays/List<T>/IEnumerable<T>, [SpacetimeDB.Type] enums and records, SpacetimeDB.I128/U128/I256/U256","Rebuild after the change — this fails at compile time, so a clean build means the schema is clean"],"exampleFix":"// before\n[SpacetimeDB.Type]\npublic partial struct Frame {\n    public byte* Data;        // Unsupported type\n}\n\n// after\n[SpacetimeDB.Type]\npublic partial struct Frame {\n    public byte[] Data;\n}","handlingStrategy":"validation","validationCode":"// The generator IS the validation: it runs during `dotnet build` and fails fast.\n// Keep schema types on this whitelist:\n//   bool, sbyte, byte, short, ushort, int, uint, long, ulong, float, double, string,\n//   byte[], T[], List<T>, int?, string?,\n//   [SpacetimeDB.Type] enums/structs/records,\n//   SpacetimeDB.{I128,U128,I256,U256,Identity}\n// Anything else (pointers, delegate*, dynamic) is rejected at compile time.","typeGuard":null,"tryCatchPattern":"// compile-time error: nothing to catch. Fix the schema type and rebuild.","preventionTips":["Keep native/interop types out of schema-reachable types","Add a CI build of the schema project so unsupported types fail the pipeline","Review the supported-type list when upgrading the SDK"],"tags":["csharp","source-generator","bsatn","schema","type-mapping"],"backgroundTag":"codegen-unsupported-type","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}