System.OperationCanceledException When Disposing DataStore
See original GitHub issueI’m using your library to implement a set of local data stores. I love this library and the implementation. I am seeing a behavior I am trying to resolve as I am implementing unhandled exception handling now in the my .NET 6 WPF application. So this keeps tripping it…
Here is an example of one of my methods on one of the repositories:
public IEnumerable<QuestionSet> GetAll()
{
using (var ds = new DataStore(_fileName, true, nameof(QuestionSet.PrimaryKey)))
{
var coll = ds.GetCollection<QuestionSet>();
return coll.AsQueryable().ToList();
}
}
After the ‘using’ exits I always get a: System.OperationCanceledException
If I don’t use ‘using’ or do not Dispose, I don’t see the exception.
Should I not be wrapping the DataStore object in a using? Or am I using the library in the wrong way?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
C# : OperationCanceledException : The operation was ...
An OperationCanceledException exception typically means that an Event Hubs service operation timed out. In your stack trace, it appears that ...
Read more >The operation was canceled - when querying statistics
System.OperationCanceledException: The operation was canceled - when querying statistics ... Just recording here what we've seen on our integration test suite.
Read more >OperationCanceledException Class (System)
The exception that is thrown in a thread upon cancellation of an operation that the thread was executing.
Read more >Stop wasting server resources by properly using ... - YouTube
TaskCanceledException inherits from OperationCanceledException, so you only really need to catch the latter.
Read more >Thread: [RESOLVED] Cancellation of task
But when I do I get an error stating: System.OperationCanceledException: 'The operation was canceled.' and sends me into a break screen.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nabeelio Good that you found a workaround👍
New version with the fix in now released https://www.nuget.org/packages/JsonFlatFileDataStore/2.4.1
Hi @ttu sorry for the delayed response, just getting back to this. Thanks for the fix! I stopped calling
Dispose()
manually and that ended up fixing it too, but maybe there were still some side-effects which are fixed. I’ll upgrade the library today! Thanks again!