Nevermore
Nevermore copied to clipboard
System.InvalidOperationException when disposing a read transaction
I'm testing a few cases with Nevermore and encountered an exeception when disposes a ReadTransaction: System.InvalidOperationException: There is already an open DataReader associated with this Connection which must be closed first.
You can see the code here: The exeception is thrown on the end of the program (when dispose is called because of the using statement in line 74) https://github.com/RolandKoenig/HappyCoding/blob/main/2022/HappyCoding.JsonDocumentsWithNevermore/HappyCoding.JsonDocumentsWithNevermore/Program.cs I'm using the version 17.0.1 of Nevermore
Is there anything wrong with my code or is this a bug?
This call needs an 'await', otherwise you are telling the GC to keep alive the task that will eventually load the document, not the document itself:
var readDocument =
readTransaction.LoadRequiredAsync<TestingDocument>(expectedDocument.ID);