8,655 questions
1
vote
1
answer
163
views
Why task cancellation does not work in my code?
I have a code that creates qr-code in MainThread after user's typing. To prevent generation after each small change I tried to create kind of timer with Task.Delay and CancellationToken that could be ...
1
vote
1
answer
81
views
Why does the NetworkStream.ReadAsync call end the loop
I have a Task that should continuously read from a Tcp stream and place the data into a ConcurrentQueue for processing. Stepping through the function I notice that the ReadAsync Call does not return.
...
1
vote
4
answers
187
views
Why can’t threads freed by Task.Run in ASP.NET Core be immediately reused to handle new HTTP requests?
I’m building an ASP.NET Core Web API hosted on Kestrel. Incoming HTTP requests are dispatched to the ThreadPool, which picks an available thread to execute my controller action. Inside that action, I ...
2
votes
1
answer
220
views
Awaiting a TaskCompletionSource from two threads
I got curious about what would happen if you await a TaskCompletionSource from two threads.
using System.Diagnostics;
var t = Start();
var t1 = Task.Run(async () => {
await t;
Thread.Sleep(...
2
votes
0
answers
60
views
Persistent parallel threads in Panda3d, with args at runtime
I'm writing a physics game, and I'm trying to speed up my motion calculations. Every tick of the update cycle, I call an rk4 routine which calls an ODE function 4 times, passing updated values for dt/...
2
votes
1
answer
251
views
Getting "Unknown attribute 'MainActor'" when using MainActor with Task
Task { @MainActor // ERROR: Unknown attribute 'MainActor'
handleSuccess(of: response)
}
I thought you can use actors on Tasks. Not sure what I'm doing wrong.
2
votes
1
answer
293
views
How to execute Quartz jobs in virtual threads
How can I leverage virtual threads to execute I/O-bound Quartz jobs within a Quarkus microservice, handling programmatic job triggering without cron-based scheduling?
We are considering Quartz for our ...
0
votes
0
answers
38
views
Detail View on a different View Controller not showing after selecting a map pin possibly because of a Task block Swift [duplicate]
When I press on a map pin, the detail view on a different View Controller for the selected restuarant’s pin is not shown. I think this is occurring because of the Task block I'm using.
Its an iOS ...
-3
votes
2
answers
158
views
ManualResetEventSlim.Wait() blocks all tasks started with Task.Run
I am trying to create my own OutOfMemoryException protection.
It seems that ManualResetEventSlim.Wait() blocks both tasks. As soon as ManualResetEventSlim.Wait() is reached, the application stops ...
1
vote
0
answers
85
views
RabbitMQ Consumer can't manually ack?
For a professional need, I used RabbitMQ to streamline tasks. The frameworks and libraries used are:
RabbitMQ.Client 7.1.2
.NET 8.0
My task is basic: copy files from one location to another.
So I ...
0
votes
1
answer
49
views
Run few dialogs in WinUI3
I need to run few ContentDialog one by one. I use this code below to run dialogs:
await App.GetService<IFirstRunDisplayService>().ShowIfAppropriateAsync(App.AppXamlRoot);
await ...
0
votes
2
answers
81
views
C# Task cancelafter/cancel not worked [duplicate]
I'm trying to cancel a task if it runs longer than the specified time, but the cancelafter/cancel methods don't cancel the task. I've looked at solutions to similar problems, but I haven't found an ...
0
votes
1
answer
101
views
Why does Task.Factory.StartNew for an async lambda work, when calling the lambda directly does not?
I'm writing a console application that needs to copy console input one keypress at a time to a socket (while also doing other things). In order to do that, I figure I have a couple options. In the ...
0
votes
2
answers
140
views
Task.WhenAny with Task.Delay to implement a timeout mechanism does not work reliable
From within my ASP.NET application (.NET Framework 4.8) I invoke an external process via Anonymous Pipes. Theoretically, it could happen that the external process hangs (for whatever reason) when my ...
0
votes
2
answers
67
views
DbContext is not returning any data that is in the database
Why is allRecords returning with zero records when the database has records?
public record struct ImposterDbContextAuthorization(int AccountUserId, bool HasPermissionCanAccessAnyAccount, bool ...
3
votes
2
answers
143
views
Getting a 2nd `IAsyncEnumerator<>` from the same `IAsyncEnumerable<>` based on `Task.WhenEach<>` method
Given one IAsyncEnumerable<>, in general it works fine (even if it can be nonoptimal performance-wise) to call GetAsyncEnumerator more than once, getting a new IAsyncEnumerator<> each time....
0
votes
0
answers
45
views
PoseLandmarker iOS Example
I'm trying to create a library wrapper for the MediaPipeTasksVision.framework in xcode, the wrapper is for a programming language called B4X which is a cross platform programming language and it's ...
0
votes
1
answer
57
views
How can I make a task dependent on another, but also only run at a certain time?
I have two tasks.
T05:30 - I wish for this to run at 05:30 every day.
T08:30 - I wish for this to run at 08:30 every day, but only if T05:30 has succeeded today.
Can this be achieved in Airflow? It ...
0
votes
1
answer
122
views
Proper way to combine infinite Task with Object [duplicate]
I am looking for feedback and insights on my way to a well-written C# class.
Let´s assume a Temperature Sensor which can be read via HTTP request. I want to create a class where each instance updates ...
-1
votes
2
answers
105
views
Second Task does not end although loop parameter condition is updated in separate task
Method readAllFilesAtRootFolder:
public static Dictionary<string, List<mediaFile>> readAllFilesAtRootFolder(
string rootFolder, string[] extensions, bool subFolders,
...
0
votes
0
answers
68
views
How can I pause a task in C#? [duplicate]
I am a beginner in the use of task in C#.
I have implemented a file generation window in my application which generates 3 different files. I have implemented the file generation function on a single ...
1
vote
0
answers
270
views
How to compile and run a C++ program with input from input.txt and output to output.txt in VSCode?
I'm using Visual Studio Code (VSCode) to work on a C++ project and I want to automate the process of compiling my C++ code and running it with input redirected from a file (input.txt) and the output ...
0
votes
0
answers
50
views
How can I create multiple webview2 browsers with different proxies in one app?
I'm trying to create a c# windows form that has a simple task which is to display two separate browsers each one has its own server proxy, but no matter what I do I get this error:
"System....
0
votes
0
answers
85
views
Loading data to dataGridView freezes the window during loading, why threading does not work here?
I have the following method that loads the data to DataGridView in a separate function. When I call the method in a button click, first two methods runs without hanging the windows since they dod not ...
2
votes
2
answers
68
views
Can we store an array of objects in a script parameter?
I have created a scheduled script to process invoice items. I process the items from a saved search in batches (from start: 0 to end: 50 items) and then reschedule the script. After processing (...