Comments (2)
We were also hit by this issue when updating from 6.0.0-rc1 to 6.0.0.
The issue might be in IncludePlan<T>.IncludedDocumentStatement
in which storage.FilterDocuments
is called with null session parameter. This causes the NRE in DocumentStorage<T, TId>.extraFilters
.
Here is other failing test which I created before finding this issue:
using System;
using System.Threading.Tasks;
using Bug2583;
using Marten;
using Marten.Testing.Harness;
using Shouldly;
using Weasel.Core;
using Xunit;
namespace DocumentDbTests.Bugs
{
public class Bug_2583_include_in_query_throw_null_reference_with_multi_tenant_documents: BugIntegrationContext
{
[Fact]
public async Task should_be_able_to_include_multi_tenant_documents()
{
using var documentStore = SeparateStore(x =>
{
x.AutoCreateSchemaObjects = AutoCreate.All;
x.Schema.For<TestEntity>().MultiTenanted();
x.Schema.For<OtherTestEntity>().MultiTenanted();
});
await documentStore.Advanced.Clean.DeleteAllDocumentsAsync();
var testEntityId = Guid.NewGuid();
var otherTestEntityId = Guid.NewGuid();
await using (var session = documentStore.LightweightSession("tenant"))
{
session.Store(new OtherTestEntity
{
Id = otherTestEntityId,
Name = "Other test"
});
session.Store(new TestEntity
{
Id = testEntityId,
Name = "Test",
OtherId = otherTestEntityId
});
await session.SaveChangesAsync();
}
await using (var session = documentStore.QuerySession("tenant"))
{
OtherTestEntity otherTestEntity = null;
var testEntity = await session.Query<TestEntity>()
.Include<OtherTestEntity>(x => x.OtherId, x => otherTestEntity = x)
.SingleOrDefaultAsync();
testEntity.ShouldNotBeNull();
testEntity.Id.ShouldBe(testEntityId);
otherTestEntity.ShouldNotBeNull();
otherTestEntity.Id.ShouldBe(otherTestEntityId);
}
}
}
}
namespace Bug2583
{
public class TestEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
public Guid OtherId { get; set; }
}
public class OtherTestEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
}
}
from marten.
It seems to me that #2602 should fix it.
from marten.
Related Issues (20)
- Provide IDocumentSession to custom projections and event subscriptions to allow writes in the same unit of work
- PagedList with include fails when TenantId is mapped to document
- BadLinqExpressionException when calling string.Trim HOT 1
- Projection Rebuild Deletes Existing Projected Documents from Archived Streams
- Add discriminated union support for strongly-typed identifiers
- Tombstone processing needs to track tenant id HOT 1
- UpdateRevision with SaveChangesAsync generates a ConcurrencyException
- Add support for Querying F# discriminated union properties
- FetchForWriting optimizations
- Duplicate events in inline aggregates since 7.21.0 HOT 5
- Timespan not supported for query select linq HOT 2
- mock FirstOrDefaultAsync for unit test HOT 1
- LINQ Serialization fails to use json arrows for data field HOT 2
- Strongly typed IDs not supported by Marten's event store? HOT 5
- Bulk events performance experiments HOT 7
- Marten 8.0 Plans
- Event Store Internal Improvements for 7.25
- Database Sharding on Document Tables
- Formal Specification pattern implementation in Marten for usages where compiled queries aren't usable HOT 1
- Async Projection skips events HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marten.