All Questions
Tagged with .net asynchronous
2,537
questions
1
vote
1
answer
121
views
What is the difference between await method(), await method().ConfigureAwait(true), and await method().ConfigureAwait(false) in C#?
I'm trying to understand the differences between the following three usages of the await keyword in C#:
await method();
await method().ConfigureAwait(true);
await method().ConfigureAwait(false);
...
2
votes
1
answer
46
views
How are BeginXXX methods used in the asynchronous programming model usually implemented by .Net libraries?
I understand that the Task-based Asynchronous Pattern (TAP) is now the preferred way to write async code but I was reading up on previous patterns to see how async code used to be written.
When ...
0
votes
1
answer
96
views
Difference between Debug and Release mode in Dotnet Application in a specific scenario
I was going through to reading asynchronous programming in .NET
There mention about debug and release mode of simple program using thread.
Consider following code:
internal class Program
{
static ...
2
votes
2
answers
73
views
Async event handler processing causing unexpected execution flow
I was working on a legacy application that had a bug in it and eventually tracked it down to some async event handlers executing in the form of event1 programmatically triggering event2. The original ...
0
votes
2
answers
153
views
Async/Await exception handling confusion
I'm trying to understand async/await in .net8, especially exception handling and I'm running into some confusion, especially regarding the documentation as while it specifies some of the approach it ...
1
vote
2
answers
74
views
Should.ThrowAsync not catching exception from HttpClient.GetAsync() request
In our project we have a test written by a former colleague that is firing a request to an end point, which should - and does - return a 500 - InternalServerError (checking for this using Shouldly) ...
0
votes
1
answer
97
views
Async method call is blocking main thread [duplicate]
I have an async method like this:
public async Task SpecifyAsync()
{
CancellationTokenSource source = new();
Task<long> checkTask = BeginCheckingAsync(source.Token);
SendMessage();
...
-1
votes
1
answer
172
views
.NET 8: return the response 200 immediately for long running process
I am working on an ASP.NET Core 8 Web API endpoint that will be called from a WPF client application. This endpoint needs to process a large amount of data sent from the WPF client. The client doesn't ...
1
vote
2
answers
112
views
Can I setup an async operation to happen automatically after another async operation has completed?
I have a bit of a weird case. I have a list that looks something like:
var myStuff = [A:1, A:2, A:3, B:1, B:2, C:1, C:2, C:3, C:4];
For all letters, I want to start Tasks for each version except for ...
0
votes
2
answers
129
views
Async method lacks 'await' operator
.Net 4.8 project with C# and trying to tidy this function:
public class AuthorizationServiceProvider : OAuthAuthorizationServerProvider
{
public override async Task ValidateClientAuthentication(...
0
votes
1
answer
110
views
Confusion with async task running in unexpected order
I call a method from here:
public async void LoadingWindow_Loaded(object sender, RoutedEventArgs e)
{
List<(string fileName, string folderName, string destFolder)> filesToDownload = new()
...
0
votes
1
answer
56
views
Async call to third party slows down a request
I have a command in .NET that creates some entities and returns a result. During the command, it sends an email with the information about the entity. It uses a service I get using DI and the call is ...
1
vote
1
answer
92
views
Types of asynchronous background code execution in REST API endpoint
I am implementing a REST API endpoint in ASP.NET, that should do the following:
Asynchronously start a long-running algorithm
Return 202 Accepted immediately after starting the algorithm (no await)
...
0
votes
0
answers
74
views
How can I give an ID to CancellationToken?
I have a system that links tokens received from different places. Then, it uses this merged token to perform some task. The final merged token can consist of 5 different tokens.
While the task is ...
0
votes
1
answer
2k
views
Correct use of IAsyncEnumerable in EF Core
What is the correct way to perform a query in Entity Framework Core that returns the data as IAsyncEnumerable<T>?
I've come to the conclusion I should return data from a query as an ...