xUnit InMemoryDatabase Test failure: InvalidOperationException
up vote
2
down vote
favorite
I run Unit-Tests on TFS in a CI environment, today it failed with the following exception:
Error:
System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Stacktrace:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.GetDisplayName(Type type)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.FindEntityType(Type type)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.RewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Remotion.Linq.Clauses.WhereClause.TransformExpressions(Func`2 transformation)
at Remotion.Linq.QueryModel.TransformExpressions(Func`2 transformation)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryOptimizer.Optimize(QueryCompilationContext queryCompilationContext, QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.OptimizeQueryModel(QueryModel queryModel, Boolean asyncQuery)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, IQueryModelGenerator queryModelGenerator, IDatabase database, IDiagnosticsLogger`1 logger, Type contextType)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass13_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
at ModelNamespace.SomeRepository.TestMethod()
at TestNamespace.SomeRepositoryTest.TestMethod_Test()
After that I started the same build on the same commit again and it succeeded. Odd isn't it?
How the Tests are built up
To set up InMemoryDatabases, we use the following helper Class:
public class DbContextTestHelper
{
public static DbContextOptions<CustomContext> PrepareData(Action<CustomContext> createData)
{
var options = CreateDbContextOptions();
SaveData(options, createData);
return options;
}
private static void SaveData(DbContextOptions<CustomContext> options, Action<CustomContext> createData)
{
// Insert seed data into the database using one instance of the context
using (var context = new CustomContext(options))
{
createData.Invoke(context);
context.SaveChanges();
}
}
private static DbContextOptions<CustomContext> CreateDbContextOptions()
{
return new DbContextOptionsBuilder<CustomContext>()
.UseInMemoryDatabase(Guid.NewGuid()
.ToString()) //Database with same name gets reused, so let's isolate the tests from each other...
.Options;
}
}
So now we have many Tests we build up like this:
public class SomeRepositoryTest
{
[Fact]
public async Task TestMethod_Test()
{
var options = DbContextTestHelper.PrepareData(context =>
{
// do some initialisation
});
// Use a clean instance of the context to run the test
using (var context = new CustomContext(options))
{
var testee = new SomeRepository(context);
await testee.TestMethod(); // InvalidOperationException from above
// Assert something
}
}
}
Of course there are many cases where we create those DbContextOptions<CustomContext>
and naturally they run parallel because of the built-in functionality that xUnit
provides (yes of course not in the same class but for many test classes).
My Question
As far as I can tell there are few possibilities of why this can sometimes cause an exception:
- the GUID's generated to ensure different instances of InMemoryDatabases are duplicates. However I'd rather not believe this.
- there is a bug in the InMememory Database System
- We are using InMemoryDatabases wrong
Do you know what's going on?
Edit 1:
As Requested, here's the TestMethod()
where System.Linq.Queryable.Any[TSource](IQueryable'1 source)
gets called.
public void TestMethod(SomeObject someObject, List<DateTime> dates, bool someOption)
{
var res = _dbContext.SomeSet.Where(o =>
o.SomeObject.Equals(someObject) && dates.Contains(o.DateTime) && o.SomeOption == someOption);
if (res.Any()) // at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
{
_dbContext.SomeSet.RemoveRange(res);
}
}
c# xunit in-memory-database ef-core-2.1 .net-core-2.1
add a comment |
up vote
2
down vote
favorite
I run Unit-Tests on TFS in a CI environment, today it failed with the following exception:
Error:
System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Stacktrace:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.GetDisplayName(Type type)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.FindEntityType(Type type)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.RewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Remotion.Linq.Clauses.WhereClause.TransformExpressions(Func`2 transformation)
at Remotion.Linq.QueryModel.TransformExpressions(Func`2 transformation)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryOptimizer.Optimize(QueryCompilationContext queryCompilationContext, QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.OptimizeQueryModel(QueryModel queryModel, Boolean asyncQuery)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, IQueryModelGenerator queryModelGenerator, IDatabase database, IDiagnosticsLogger`1 logger, Type contextType)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass13_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
at ModelNamespace.SomeRepository.TestMethod()
at TestNamespace.SomeRepositoryTest.TestMethod_Test()
After that I started the same build on the same commit again and it succeeded. Odd isn't it?
How the Tests are built up
To set up InMemoryDatabases, we use the following helper Class:
public class DbContextTestHelper
{
public static DbContextOptions<CustomContext> PrepareData(Action<CustomContext> createData)
{
var options = CreateDbContextOptions();
SaveData(options, createData);
return options;
}
private static void SaveData(DbContextOptions<CustomContext> options, Action<CustomContext> createData)
{
// Insert seed data into the database using one instance of the context
using (var context = new CustomContext(options))
{
createData.Invoke(context);
context.SaveChanges();
}
}
private static DbContextOptions<CustomContext> CreateDbContextOptions()
{
return new DbContextOptionsBuilder<CustomContext>()
.UseInMemoryDatabase(Guid.NewGuid()
.ToString()) //Database with same name gets reused, so let's isolate the tests from each other...
.Options;
}
}
So now we have many Tests we build up like this:
public class SomeRepositoryTest
{
[Fact]
public async Task TestMethod_Test()
{
var options = DbContextTestHelper.PrepareData(context =>
{
// do some initialisation
});
// Use a clean instance of the context to run the test
using (var context = new CustomContext(options))
{
var testee = new SomeRepository(context);
await testee.TestMethod(); // InvalidOperationException from above
// Assert something
}
}
}
Of course there are many cases where we create those DbContextOptions<CustomContext>
and naturally they run parallel because of the built-in functionality that xUnit
provides (yes of course not in the same class but for many test classes).
My Question
As far as I can tell there are few possibilities of why this can sometimes cause an exception:
- the GUID's generated to ensure different instances of InMemoryDatabases are duplicates. However I'd rather not believe this.
- there is a bug in the InMememory Database System
- We are using InMemoryDatabases wrong
Do you know what's going on?
Edit 1:
As Requested, here's the TestMethod()
where System.Linq.Queryable.Any[TSource](IQueryable'1 source)
gets called.
public void TestMethod(SomeObject someObject, List<DateTime> dates, bool someOption)
{
var res = _dbContext.SomeSet.Where(o =>
o.SomeObject.Equals(someObject) && dates.Contains(o.DateTime) && o.SomeOption == someOption);
if (res.Any()) // at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
{
_dbContext.SomeSet.RemoveRange(res);
}
}
c# xunit in-memory-database ef-core-2.1 .net-core-2.1
This appears to be an issue inEntityFrameworkCore
github.com/IdentityServer/IdentityServer4/issues/2453. One suggested fix is to useConcurrentDictionary
– obl
yesterday
@obl the point is, that im not at all accessing any dictionary. I only have an InMemoryDB and a DbContext. There are onlyDbSet<T>
which I access. So im not really able to change this behavior.
– LuckyLikey
yesterday
Gotcha. Can you find theSystem.Linq.Queryable.Any[TSource](IQueryable`1 source)
query mentioned in the stack trace and post it?
– obl
14 hours ago
@obl added it. hope it helps
– LuckyLikey
52 mins ago
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I run Unit-Tests on TFS in a CI environment, today it failed with the following exception:
Error:
System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Stacktrace:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.GetDisplayName(Type type)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.FindEntityType(Type type)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.RewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Remotion.Linq.Clauses.WhereClause.TransformExpressions(Func`2 transformation)
at Remotion.Linq.QueryModel.TransformExpressions(Func`2 transformation)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryOptimizer.Optimize(QueryCompilationContext queryCompilationContext, QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.OptimizeQueryModel(QueryModel queryModel, Boolean asyncQuery)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, IQueryModelGenerator queryModelGenerator, IDatabase database, IDiagnosticsLogger`1 logger, Type contextType)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass13_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
at ModelNamespace.SomeRepository.TestMethod()
at TestNamespace.SomeRepositoryTest.TestMethod_Test()
After that I started the same build on the same commit again and it succeeded. Odd isn't it?
How the Tests are built up
To set up InMemoryDatabases, we use the following helper Class:
public class DbContextTestHelper
{
public static DbContextOptions<CustomContext> PrepareData(Action<CustomContext> createData)
{
var options = CreateDbContextOptions();
SaveData(options, createData);
return options;
}
private static void SaveData(DbContextOptions<CustomContext> options, Action<CustomContext> createData)
{
// Insert seed data into the database using one instance of the context
using (var context = new CustomContext(options))
{
createData.Invoke(context);
context.SaveChanges();
}
}
private static DbContextOptions<CustomContext> CreateDbContextOptions()
{
return new DbContextOptionsBuilder<CustomContext>()
.UseInMemoryDatabase(Guid.NewGuid()
.ToString()) //Database with same name gets reused, so let's isolate the tests from each other...
.Options;
}
}
So now we have many Tests we build up like this:
public class SomeRepositoryTest
{
[Fact]
public async Task TestMethod_Test()
{
var options = DbContextTestHelper.PrepareData(context =>
{
// do some initialisation
});
// Use a clean instance of the context to run the test
using (var context = new CustomContext(options))
{
var testee = new SomeRepository(context);
await testee.TestMethod(); // InvalidOperationException from above
// Assert something
}
}
}
Of course there are many cases where we create those DbContextOptions<CustomContext>
and naturally they run parallel because of the built-in functionality that xUnit
provides (yes of course not in the same class but for many test classes).
My Question
As far as I can tell there are few possibilities of why this can sometimes cause an exception:
- the GUID's generated to ensure different instances of InMemoryDatabases are duplicates. However I'd rather not believe this.
- there is a bug in the InMememory Database System
- We are using InMemoryDatabases wrong
Do you know what's going on?
Edit 1:
As Requested, here's the TestMethod()
where System.Linq.Queryable.Any[TSource](IQueryable'1 source)
gets called.
public void TestMethod(SomeObject someObject, List<DateTime> dates, bool someOption)
{
var res = _dbContext.SomeSet.Where(o =>
o.SomeObject.Equals(someObject) && dates.Contains(o.DateTime) && o.SomeOption == someOption);
if (res.Any()) // at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
{
_dbContext.SomeSet.RemoveRange(res);
}
}
c# xunit in-memory-database ef-core-2.1 .net-core-2.1
I run Unit-Tests on TFS in a CI environment, today it failed with the following exception:
Error:
System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Stacktrace:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.GetDisplayName(Type type)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.FindEntityType(Type type)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.RewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.EntityEqualityRewritingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Remotion.Linq.Clauses.WhereClause.TransformExpressions(Func`2 transformation)
at Remotion.Linq.QueryModel.TransformExpressions(Func`2 transformation)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryOptimizer.Optimize(QueryCompilationContext queryCompilationContext, QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.OptimizeQueryModel(QueryModel queryModel, Boolean asyncQuery)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, IQueryModelGenerator queryModelGenerator, IDatabase database, IDiagnosticsLogger`1 logger, Type contextType)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass13_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
at ModelNamespace.SomeRepository.TestMethod()
at TestNamespace.SomeRepositoryTest.TestMethod_Test()
After that I started the same build on the same commit again and it succeeded. Odd isn't it?
How the Tests are built up
To set up InMemoryDatabases, we use the following helper Class:
public class DbContextTestHelper
{
public static DbContextOptions<CustomContext> PrepareData(Action<CustomContext> createData)
{
var options = CreateDbContextOptions();
SaveData(options, createData);
return options;
}
private static void SaveData(DbContextOptions<CustomContext> options, Action<CustomContext> createData)
{
// Insert seed data into the database using one instance of the context
using (var context = new CustomContext(options))
{
createData.Invoke(context);
context.SaveChanges();
}
}
private static DbContextOptions<CustomContext> CreateDbContextOptions()
{
return new DbContextOptionsBuilder<CustomContext>()
.UseInMemoryDatabase(Guid.NewGuid()
.ToString()) //Database with same name gets reused, so let's isolate the tests from each other...
.Options;
}
}
So now we have many Tests we build up like this:
public class SomeRepositoryTest
{
[Fact]
public async Task TestMethod_Test()
{
var options = DbContextTestHelper.PrepareData(context =>
{
// do some initialisation
});
// Use a clean instance of the context to run the test
using (var context = new CustomContext(options))
{
var testee = new SomeRepository(context);
await testee.TestMethod(); // InvalidOperationException from above
// Assert something
}
}
}
Of course there are many cases where we create those DbContextOptions<CustomContext>
and naturally they run parallel because of the built-in functionality that xUnit
provides (yes of course not in the same class but for many test classes).
My Question
As far as I can tell there are few possibilities of why this can sometimes cause an exception:
- the GUID's generated to ensure different instances of InMemoryDatabases are duplicates. However I'd rather not believe this.
- there is a bug in the InMememory Database System
- We are using InMemoryDatabases wrong
Do you know what's going on?
Edit 1:
As Requested, here's the TestMethod()
where System.Linq.Queryable.Any[TSource](IQueryable'1 source)
gets called.
public void TestMethod(SomeObject someObject, List<DateTime> dates, bool someOption)
{
var res = _dbContext.SomeSet.Where(o =>
o.SomeObject.Equals(someObject) && dates.Contains(o.DateTime) && o.SomeOption == someOption);
if (res.Any()) // at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
{
_dbContext.SomeSet.RemoveRange(res);
}
}
c# xunit in-memory-database ef-core-2.1 .net-core-2.1
c# xunit in-memory-database ef-core-2.1 .net-core-2.1
edited 56 mins ago
asked yesterday
LuckyLikey
1,1821028
1,1821028
This appears to be an issue inEntityFrameworkCore
github.com/IdentityServer/IdentityServer4/issues/2453. One suggested fix is to useConcurrentDictionary
– obl
yesterday
@obl the point is, that im not at all accessing any dictionary. I only have an InMemoryDB and a DbContext. There are onlyDbSet<T>
which I access. So im not really able to change this behavior.
– LuckyLikey
yesterday
Gotcha. Can you find theSystem.Linq.Queryable.Any[TSource](IQueryable`1 source)
query mentioned in the stack trace and post it?
– obl
14 hours ago
@obl added it. hope it helps
– LuckyLikey
52 mins ago
add a comment |
This appears to be an issue inEntityFrameworkCore
github.com/IdentityServer/IdentityServer4/issues/2453. One suggested fix is to useConcurrentDictionary
– obl
yesterday
@obl the point is, that im not at all accessing any dictionary. I only have an InMemoryDB and a DbContext. There are onlyDbSet<T>
which I access. So im not really able to change this behavior.
– LuckyLikey
yesterday
Gotcha. Can you find theSystem.Linq.Queryable.Any[TSource](IQueryable`1 source)
query mentioned in the stack trace and post it?
– obl
14 hours ago
@obl added it. hope it helps
– LuckyLikey
52 mins ago
This appears to be an issue in
EntityFrameworkCore
github.com/IdentityServer/IdentityServer4/issues/2453. One suggested fix is to use ConcurrentDictionary
– obl
yesterday
This appears to be an issue in
EntityFrameworkCore
github.com/IdentityServer/IdentityServer4/issues/2453. One suggested fix is to use ConcurrentDictionary
– obl
yesterday
@obl the point is, that im not at all accessing any dictionary. I only have an InMemoryDB and a DbContext. There are only
DbSet<T>
which I access. So im not really able to change this behavior.– LuckyLikey
yesterday
@obl the point is, that im not at all accessing any dictionary. I only have an InMemoryDB and a DbContext. There are only
DbSet<T>
which I access. So im not really able to change this behavior.– LuckyLikey
yesterday
Gotcha. Can you find the
System.Linq.Queryable.Any[TSource](IQueryable`1 source)
query mentioned in the stack trace and post it?– obl
14 hours ago
Gotcha. Can you find the
System.Linq.Queryable.Any[TSource](IQueryable`1 source)
query mentioned in the stack trace and post it?– obl
14 hours ago
@obl added it. hope it helps
– LuckyLikey
52 mins ago
@obl added it. hope it helps
– LuckyLikey
52 mins ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264875%2fxunit-inmemorydatabase-test-failure-invalidoperationexception%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
This appears to be an issue in
EntityFrameworkCore
github.com/IdentityServer/IdentityServer4/issues/2453. One suggested fix is to useConcurrentDictionary
– obl
yesterday
@obl the point is, that im not at all accessing any dictionary. I only have an InMemoryDB and a DbContext. There are only
DbSet<T>
which I access. So im not really able to change this behavior.– LuckyLikey
yesterday
Gotcha. Can you find the
System.Linq.Queryable.Any[TSource](IQueryable`1 source)
query mentioned in the stack trace and post it?– obl
14 hours ago
@obl added it. hope it helps
– LuckyLikey
52 mins ago