tagged [async-await]
.Net Invoke async method and await
.Net Invoke async method and await I have an ansyc method I can call this method async and await: How can I invoke the method using MethodInfo.Invoke and await for the result asynchronously.
- Modified
- 22 Apr at 17:37
Try Catch outside of: await Task.Run(()
Try Catch outside of: await Task.Run(() Does try catch outside of: `await Task.Run(() =>` make sense or just use them only inside of await? ``` private async void Test() { try { await Task.Run...
- Modified
- 17 Jul at 15:59
SemaphoreSlim.WaitAsync before/after try block
SemaphoreSlim.WaitAsync before/after try block I know that in the sync world the first snippet is right, but what's about WaitAsync and async/await magic? Please give me some .net internals. or
- Modified
- 4 Jun at 09:43
How to return a result from an async task?
How to return a result from an async task? I would like to return a string result from an async task. Async programming confuses me, can someone please explain it?
- Modified
- 13 Dec at 08:38
MoveNext instead of actual method/task name
MoveNext instead of actual method/task name Using log4net declared as: In an async method or task, like this one: logs `MoveNext` instead of `CheckSomething`. Any idea how to make it log an actual met...
- Modified
- 23 Mar at 23:50
HttpClient does not serialize XML correctly
HttpClient does not serialize XML correctly When calling HttpClient's extension method `PostAsXmlAsync`, it ignores the `XmlRootAttribute` on the class. Is this behaviour a bug?
- Modified
- 5 Feb at 12:44
How to deal with ValueTask<T> in F#?
How to deal with ValueTask in F#? So apparently .NET's brand new `ValueTask` is the version of `Task`. That's cool, but if before I had to use `Async.AwaitTask` to integrate my F# Async workflows with...
- Modified
- 18 Sep at 07:23
At the end of an async method, should I return or await?
At the end of an async method, should I return or await? At the end of a Task-returning async method, if I call another async method, I could either `await` it or `return` its task. Which are the cons...
- Modified
- 26 Jul at 16:58
What happens to the thread when reaching 'await' on 'async' method?
What happens to the thread when reaching 'await' on 'async' method? My question as the title suggest is about the background of 'async' and 'await'. Is it true to say that what the current thread reac...
- Modified
- 1 Sep at 12:55
Brief explanation of Async/Await in .Net 4.5
Brief explanation of Async/Await in .Net 4.5 How does Asynchronous tasks (Async/Await) work in .Net 4.5? Some sample code: Does the second `await` statement get executed right away or after the first ...
- Modified
- 9 May at 13:30
Sequential await VS Continuation await
Sequential await VS Continuation await I was wondering what is the best/correct way of writing asynchronous code that is composed of two (or more) async and dependent (the first have to finish to exec...
- Modified
- 22 Apr at 15:44
Best way to handle null task inside async method?
Best way to handle null task inside async method? What is the best way to handle a `null` task inside an `async` method? ``` public class MyClass { private readonly Task task; public MyClass(Task ta...
- Modified
- 18 Dec at 16:27
Should I add async/await to a single-line function or not?
Should I add async/await to a single-line function or not? Should I add async/await to a single-line function like: Or is this unneeded overhead if the parameter does not need an asynchron call and I ...
- Modified
- 17 Oct at 08:23
How to return values from async functions using async-await from function?
How to return values from async functions using async-await from function? How can I return the value from an async function? I tried to like this it returns me this,
- Modified
- 20 Apr at 09:45
GetResponseAsync does not accept cancellationToken
GetResponseAsync does not accept cancellationToken It seems that GetResponseAsync does not accept cancellationToken in Async/Await. So the question is how can I cancel the below procedure, provided I ...
- Modified
- 8 Jun at 12:39
How does async-await not block?
How does async-await not block? I gather that the async methods are good for IO work because they don't block the thread whilst they're being awaited, but how is this actually possible? I assume somet...
- Modified
- 13 Dec at 18:36
Task.Delay for more than int.MaxValue milliseconds
Task.Delay for more than int.MaxValue milliseconds The maximum duration a `Task.Delay` can be told to delay is `int.MaxValue` milliseconds. What is the cleanest way to create a `Task` which will delay...
- Modified
- 3 May at 21:27
When does a C# Task actually start?
When does a C# Task actually start? When does a Task actually start? Does it start immediately when initializing it in `Task myTask = DoSomethingAsync();` or does it start when you say to wait for it ...
- Modified
- 29 Mar at 09:19
What is async and await and when would you use these in windows development?
What is async and await and when would you use these in windows development? I have always seen the keywords async used in Silverlight but was wondering if there is someone with a dummy's explanation ...
- Modified
- 18 Jan at 06:32
What's the difference between Task.Start/Wait and Async/Await?
What's the difference between Task.Start/Wait and Async/Await? I may be missing something but what is the difference between doing: ``` public void MyMethod() { Task t = Task.Factory.StartNew(DoSomet...
- Modified
- 24 Jun at 16:9
Asynchronous Task.WhenAll with timeout
Asynchronous Task.WhenAll with timeout Is there a way in the new async dotnet 4.5 library to set a timeout on the [Task.WhenAll](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.tas...
- Modified
- 31 Mar at 19:58
Difference between ConfigureAwait(false) and omitting await?
Difference between ConfigureAwait(false) and omitting await? You have the following method: Is there a difference in functionality between the following two invocations: The only one I see, is that Vi...
- Modified
- 3 Aug at 05:48
Await vs Task.Result in an Async Method
Await vs Task.Result in an Async Method What's the difference between doing the following: vs In my case, for some reason, only the second works. The first one never seems to end.
- Modified
- 16 Nov at 00:20
async/await keywords not available in .net 4.0
async/await keywords not available in .net 4.0 I would like to use the async/await in C# 4.0 and I have installed the following package: [http://www.nuget.org/packages/Microsoft.Bcl.Async/](http://www...
- Modified
- 7 Jun at 08:51
Are the new async and await keywords in ES7 copied from C#?
Are the new async and await keywords in ES7 copied from C#? Noticing that async and await aren't found in Java, where these new keywords in ES7 copied from the C# language? I'm curious as to the origi...
- Modified
- 10 Dec at 16:13