You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When deleting items from CosmosDB I get NullReferenceException in CosmosDatabaseWrapper. The exception is thrown when SaveChangesAsync is executed.
I believe that having a get only property that is specified as partition key causes this error. I have provided a sample project which demonstrates that If I add a setter to StoreConnectionId, the problem disappears.
Steps to reproduce
Run the provided project - efcore-cosmosdb-bug2.zip
Run the CosmosDb emulator and create a contianer with the following item:
There should be an error when SaveChangesAsync is called.
The exception is the following:
Exception has occurred: CLR/System.NullReferenceException
An exception of type 'System.NullReferenceException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Object reference not set to an instance of an object.'
at Microsoft.EntityFrameworkCore.Metadata.Internal.MetadataExtensions.AsConcreteMetadataType[TInterface,TConcrete](TInterface interface, String methodName)
at Microsoft.EntityFrameworkCore.Metadata.Internal.PropertyBaseExtensions.AsPropertyBase(IPropertyBase propertyBase, String methodName)
at Microsoft.EntityFrameworkCore.Metadata.Internal.PropertyBaseExtensions.GetPropertyAccessors(IPropertyBase propertyBase)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.GetCurrentValue[TProperty](IPropertyBase propertyBase)
at Microsoft.EntityFrameworkCore.Cosmos.Update.Internal.DocumentSource.GetId(IUpdateEntry entry)
at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosDatabaseWrapper.SaveAsync(IUpdateEntry entry, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosDatabaseWrapper.<SaveChangesAsync>d__5.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<SaveChangesAsync>d__97.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<SaveChangesAsync>d__101.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<ExecuteImplementationAsync>d__31`2.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<ExecuteImplementationAsync>d__31`2.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.EntityFrameworkCore.DbContext.<SaveChangesAsync>d__54.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at efcore_cosmosdb_bug.Program.<Main>d__0.MoveNext() in C:\Users\milan\dev\test\efcore-cosmosdb-bug2\Program.cs:line 25
This issues might be related to another one that I have reported and has already been fixed - #20916
Further technical details
EF Core version: 3.1.3
Database provider: 3.1.3
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio Code
The text was updated successfully, but these errors were encountered:
When deleting items from CosmosDB I get NullReferenceException in CosmosDatabaseWrapper. The exception is thrown when SaveChangesAsync is executed.
I believe that having a get only property that is specified as partition key causes this error. I have provided a sample project which demonstrates that If I add a setter to StoreConnectionId, the problem disappears.
Steps to reproduce
Run the provided project - efcore-cosmosdb-bug2.zip
Run the CosmosDb emulator and create a contianer with the following item:
There should be an error when SaveChangesAsync is called.
The exception is the following:
This issues might be related to another one that I have reported and has already been fixed - #20916
Further technical details
EF Core version: 3.1.3
Database provider: 3.1.3
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio Code
The text was updated successfully, but these errors were encountered: