Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e60ef4b
First pass on implementing Transactions for Procedures
rekhoff Dec 2, 2025
f4bf51b
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 3, 2025
3132d1f
Added a TxContext and pulled out ProcedureContext to the Runtime
rekhoff Dec 4, 2025
758bd23
Updated C# formatting and snapshots
rekhoff Dec 4, 2025
14d310b
More lint updates
rekhoff Dec 4, 2025
b9aafff
First pass on adding additional transaction tests
rekhoff Dec 10, 2025
c4d3fa9
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 10, 2025
eaf5615
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 10, 2025
c023c56
Cleaned up regression test client, removed Generated folder from regr…
rekhoff Dec 11, 2025
c98ce96
Removed tx offset tracking and erroneous static class
rekhoff Dec 12, 2025
85415e2
Updated to resolve test client errors
rekhoff Dec 13, 2025
793bffc
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 13, 2025
9c45746
Updated Lints and formatting
rekhoff Dec 14, 2025
40269cf
Updated Codegen-Tests snapshots and regenerated bindings for quicksta…
rekhoff Dec 14, 2025
a9479fa
Updated formatting on regression tests server and client
rekhoff Dec 14, 2025
86bd403
Remove unnecessary changes
rekhoff Dec 16, 2025
645bded
Removed unnecessary async operation
rekhoff Dec 16, 2025
7526796
Treating Unit as Void, revert ProcedureEvent changes
rekhoff Dec 16, 2025
2c7a7b6
Reverted changes to csharp.rs and removed async elements from IIntern…
rekhoff Dec 16, 2025
ce58664
Dropped ProcedureContextManager in favor of folding functionality int…
rekhoff Dec 16, 2025
df534ac
Reverted csharp.rs
rekhoff Dec 16, 2025
701d6e4
Removed unnecessary readonly flag
rekhoff Dec 16, 2025
becea5f
Rearranged generated FFI content and reverted LocalReadOnly to sealed
rekhoff Dec 16, 2025
ea07277
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 16, 2025
23b723a
Regenerating bindings for regression test client
rekhoff Dec 16, 2025
550322d
Reverted a number of formatting and generated files
rekhoff Dec 16, 2025
ae3270b
Merge branch 'rekhoff/csharp-procedure-transactions' of https://githu…
rekhoff Dec 16, 2025
c22ab6e
Reverted changes to Event.cs
rekhoff Dec 17, 2025
3cec56f
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 17, 2025
0feb718
Updated Lints
rekhoff Dec 17, 2025
4e1fe9d
Merge branch 'rekhoff/csharp-procedure-transactions' of https://githu…
rekhoff Dec 17, 2025
5a25ad5
Updated Codegen.Tests snapshots
rekhoff Dec 17, 2025
4348c90
Updated Procedure results to use a more-Rust-like generic `Result<T,E>`
rekhoff Dec 17, 2025
058e04d
Merge branch 'master' into rekhoff/csharp-procedure-transactions
rekhoff Dec 17, 2025
b380abb
Updated lints
rekhoff Dec 17, 2025
4d5eb1e
Updated Codegen.Tests snapshots
rekhoff Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/bindings-csharp/BSATN.Codegen/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public abstract record TypeUse(string Name, string BSATNName)
/// <returns></returns>
public static TypeUse Parse(ISymbol member, ITypeSymbol typeSymbol, DiagReporter diag)
{
if (typeSymbol.SpecialType == SpecialType.System_Void)
{
// Treat void as equivalent to Unit type
return new ReferenceUse("SpacetimeDB.Unit", "SpacetimeDB.Unit.BSATN");
}

var type = SymbolToName(typeSymbol);
string typeInfo;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand All @@ -20,7 +19,10 @@

<ItemGroup>
<ProjectReference Include="../BSATN.Runtime/BSATN.Runtime.csproj" />
<ProjectReference Include="../BSATN.Codegen/BSATN.Codegen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference
Include="../BSATN.Codegen/BSATN.Codegen.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"
/>
</ItemGroup>

</Project>
33 changes: 10 additions & 23 deletions crates/bindings-csharp/BSATN.Runtime.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,12 @@ public BasicDataClass((int x, string y, int? z, string? w) data)
}

[Type]
public partial struct BasicDataStruct
public partial struct BasicDataStruct((int x, string y, int? z, string? w) data)
{
public int X;
public string Y;
public int? Z;
public string? W;

public BasicDataStruct((int x, string y, int? z, string? w) data)
{
X = data.x;
Y = data.y;
Z = data.z;
W = data.w;
}
public int X = data.x;
public string Y = data.y;
public int? Z = data.z;
public string? W = data.w;
}

[Type]
Expand Down Expand Up @@ -315,12 +307,12 @@ public void Add(bool collides)
}
}

public double CollisionFraction
public readonly double CollisionFraction
{
get => (double)Collisions / (double)Comparisons;
}

public void AssertCollisionsLessThan(double fraction)
public readonly void AssertCollisionsLessThan(double fraction)
{
Assert.True(
CollisionFraction < fraction,
Expand Down Expand Up @@ -626,18 +618,13 @@ public static void GeneratedNestedListRoundTrip()
.Select(list => new ContainsNestedList(list));
#pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.


static readonly Gen<(ContainsNestedList e1, ContainsNestedList e2)> GenTwoContainsNestedList =
Gen.Select(GenContainsNestedList, GenContainsNestedList, (e1, e2) => (e1, e2));

class EnumerableEqualityComparer<T> : EqualityComparer<IEnumerable<T>>
class EnumerableEqualityComparer<T>(EqualityComparer<T> equalityComparer)
: EqualityComparer<IEnumerable<T>>
{
private readonly EqualityComparer<T> EqualityComparer;

public EnumerableEqualityComparer(EqualityComparer<T> equalityComparer)
{
EqualityComparer = equalityComparer;
}
private readonly EqualityComparer<T> EqualityComparer = equalityComparer;

public override bool Equals(IEnumerable<T>? x, IEnumerable<T>? y) =>
x == null ? y == null : (y == null ? false : x.SequenceEqual(y, EqualityComparer));
Expand Down
14 changes: 10 additions & 4 deletions crates/bindings-csharp/BSATN.Runtime/BSATN.Runtime.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>SpacetimeDB.BSATN.Runtime</AssemblyName>
<Version>1.11.0</Version>
Expand All @@ -18,18 +17,25 @@

<ItemGroup>
<!-- We want to build BSATN.Codegen both to include it in our NuGet package but also we want it to transform [SpacetimeDB.Type] usages in BSATN.Runtime code itself. -->
<ProjectReference Include="../BSATN.Codegen/BSATN.Codegen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference
Include="../BSATN.Codegen/BSATN.Codegen.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"
/>
</ItemGroup>

<ItemGroup>
<None Include="../Runtime/README.md" Pack="true" PackagePath="" />
<!-- We want all users who depends on BSATN.Runtime to automatically get the Roslyn codegen component as well. -->
<None Include="../BSATN.Codegen/bin/$(Configuration)/netstandard2.0/SpacetimeDB.BSATN.Codegen.dll" Pack="true" PackagePath="analyzers/dotnet/cs" />
<None
Include="../BSATN.Codegen/bin/$(Configuration)/netstandard2.0/SpacetimeDB.BSATN.Codegen.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
/>
</ItemGroup>

<ItemGroup>
<!-- dev-dependency to add internal C# classes and attributes not included in .NET Standard -->
<PackageReference Include="PolySharp" Version="1.14.1" PrivateAssets="all" />
</ItemGroup>

</Project>
12 changes: 3 additions & 9 deletions crates/bindings-csharp/BSATN.Runtime/BSATN/AlgebraicType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ public interface ITypeRegistrar
}

[SpacetimeDB.Type]
public partial struct AggregateElement
public partial struct AggregateElement(string name, AlgebraicType algebraicType)
{
public string? Name;
public string? Name = name;

public AlgebraicType AlgebraicType;

public AggregateElement(string name, AlgebraicType algebraicType)
{
Name = name;
AlgebraicType = algebraicType;
}
public AlgebraicType AlgebraicType = algebraicType;
}

[SpacetimeDB.Type]
Expand Down
Loading
Loading