Skip to content

Remove dangling CurrentTransaction properties that always return null#60

Merged
mrdevrobot merged 2 commits intomainfrom
copilot/fix-currenttransaction-null-issue
Apr 14, 2026
Merged

Remove dangling CurrentTransaction properties that always return null#60
mrdevrobot merged 2 commits intomainfrom
copilot/fix-currenttransaction-null-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

After the caller-owned transaction refactoring in f42b3e6, BLiteEngine.CurrentTransaction and DocumentDbContext.CurrentTransaction became dead code hardwired to null, silently breaking any code that read the property after calling BeginTransaction().

Changes

  • IDocumentDbContext — removes ITransaction? CurrentTransaction { get; } from the interface contract
  • BLiteEngine / DocumentDbContext — removes the => null stub implementations
  • BLiteEngineAdditionalTests — removes three tests that asserted the property was null (now stale)
  • WHATS_NEW_4.3.md — drops CurrentTransaction from the documented interface snippet

BLiteSession.CurrentTransaction is unchanged — it tracks a real per-session transaction and remains valid.

Migration

// ❌ Broken in 4.3 — CurrentTransaction was always null
db.BeginTransaction();
var tx = db.CurrentTransaction;

// ✅ Correct pattern — capture the return value directly
var tx = db.BeginTransaction();

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll 20' --output-dircredential.username (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…nd DocumentDbContext

Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/1ccc90b6-c35c-46eb-a95b-3749d4bb4032

Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CurrentTransaction returning null in v4.3 Remove dangling CurrentTransaction properties that always return null Apr 14, 2026
Copilot AI requested a review from mrdevrobot April 14, 2026 07:32
@mrdevrobot mrdevrobot marked this pull request as ready for review April 14, 2026 22:39
Copilot AI review requested due to automatic review settings April 14, 2026 22:39
@mrdevrobot mrdevrobot merged commit 1f015ce into main Apr 14, 2026
1 check passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the now-dead CurrentTransaction API surface from BLiteEngine/DocumentDbContext and from IDocumentDbContext, after the caller-owned transaction refactor made those properties permanently null.

Changes:

  • Remove ITransaction? CurrentTransaction { get; } from IDocumentDbContext.
  • Remove the => null stub CurrentTransaction implementations from BLiteEngine and DocumentDbContext.
  • Remove stale tests asserting BLiteEngine.CurrentTransaction is null, and update the 4.3 “what’s new” interface snippet accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/BLite.Tests/BLiteEngineAdditionalTests.cs Deletes stale tests that asserted engine-level CurrentTransaction was null.
src/BLite.Core/IDocumentDbContext.cs Removes CurrentTransaction from the public interface contract.
src/BLite.Core/DocumentDbContext.cs Removes CurrentTransaction stub property returning null.
src/BLite.Core/BLiteEngine.cs Removes CurrentTransaction stub property returning null.
WHATS_NEW_4.3.md Updates the documented IDocumentDbContext snippet to no longer include CurrentTransaction.
Comments suppressed due to low confidence (1)

tests/BLite.Tests/BLiteEngineAdditionalTests.cs:231

  • This test is named as if it covers the synchronous BeginTransaction(), but it actually calls BeginTransactionAsync(). Either update the test to call BeginTransaction() or rename it so it matches what is being exercised; otherwise it can mask regressions in the sync API.
    public async Task BeginTransaction_ReturnsActiveTransaction()
    {
        var txn = await _engine.BeginTransactionAsync();
        Assert.NotNull(txn);
        Assert.Equal(TransactionState.Active, txn.State);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread WHATS_NEW_4.3.md
Comment on lines 343 to 347
### DbContext Transaction API

```csharp
public interface IDocumentDbContext
{
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 this pull request may close these issues.

[API Cleanup] CurrentTransaction is always null in v4.3 (Dangling property after refactoring)

3 participants