All Questions
Tagged with concurrency .net
512
questions
0
votes
0
answers
25
views
Problem with concurrency while updating data in DB using Quartz .NET and EF Core
I want to introduce horizontal scaling instead of vertical in my app.
Now we are using Quartz .NET for background tasks, but in non-clustered mode, just 1 instance.
So I found ability to do horizontal ...
0
votes
1
answer
53
views
How would I create a concurrency token check on multiple columns in my DB table in EF Core?
I have to charge my users a monthly fee and want to make sure I don't charge them twice.
I created a table called PlatformFee that looks like this to check to see if I've charged them. If there's any ...
0
votes
1
answer
53
views
Optimistic Concurrency Exception when Updating Entity with List<saleComments> Relationship in Entity Framework Core
I am trying to update a saleOrder entity in the database using Entity Framework Core. The entity has a property List<saleComments> Comments.
I have an issue when attempting to save the changes, ...
0
votes
0
answers
41
views
How to resolve "InvalidOperationException: A second operation was started on this context instance before a previous operation completed."
I'm encountering an issue with my ASP.NET Core application where I'm receiving the following exception:
InvalidOperationException: A second operation was started on this context instance before a ...
0
votes
0
answers
42
views
.NET 7 multiple concurrent HTTP requests blocking each other (threadpool contention?)
I have an application that queries a large number of separate systems to check user access status. For each system, it typically requires requesting an access token and then making one or more ...
0
votes
0
answers
30
views
Writing content of MemoryCache to database and race conditions
I am implementing in C# .NET a simple message consumer that reads off a queue a bunch of key, value pair messages and I need to maintain a dictionary of key -> [values seen so far] (this is ...
1
vote
1
answer
239
views
.NET A second operation was started on this context instance before a previous operation completed
I am getting this error: "System.InvalidOperationException: 'A second operation was started on this context instance before a previous operation completed. This is usually caused by different ...
0
votes
1
answer
71
views
Dictionary Thread Safety when updating keys in different threads
I have a very specific use case where I need to update each key of a dictionary with a value I will have available from another dictionary in the same method context.
While I know that dictionaries ...
5
votes
2
answers
110
views
.NET Concurrent Dictionary Exchange Value
Is there a data structure similar to ConcurrentDictionary<TKey,TValue> and Interlocked.Exchange<T>(...) that would allow you atomically to set a new value and retrieve the old value ...
-1
votes
2
answers
130
views
Nested asynchronous tasks in .NET
I'm writing a script for extending one of my datasets of email data with some features that I have to compute by calling external APIs. I have to use C#, which is not a language I'm very confident ...
2
votes
2
answers
111
views
Bizarre concurrent behavior when I cast `ConcurrentDictionary` to an `IDictionary`
I have the following test:
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading.Tasks;
public class Program
{
public static void Main()
...
0
votes
0
answers
119
views
How to run parallel operations on set of files?
So I'm trying to run parallel operations on a set of files using C#.
The first operation converts the file type and stores it in a temporary folder. The second operation does some processing to the ...
0
votes
1
answer
50
views
Could there be concurrency issues if I update other keys during a key update inside C# ConcurrentDictionary?
In C# 7, I am making a call to a concurrent dictionary with "GetOrAdd". I have a composite key, say something like "Key1,Part-key1". Inside the value factory I can retrieve the ...
0
votes
0
answers
84
views
C# volatile usage for struct fields accessed from different threads
I am writing a library with task-like types for handling async/await code, to get a better understanding of how Tasks work in .NET under the hood.
What bothers me is the situation when multiple ...
0
votes
0
answers
12
views
Finite concurrent API get requests via HttpClient
I've deliberated on whether to include the code I've tried to date, but I think it's going to be easier to ask this from a blank slate given how many possible approaches there are. I'm a hobby coder ...