CommandLineApplication.ExecuteAsync is inherently synchronous
See original GitHub issueDescribe the bug ExecuteAsync is not asynchronous. This seems related to bugs #153 and #196.
All of the ExecuteAsync methods eventually call the method below in CommandLineApplication.Execute.cs.
public static Task<int> ExecuteAsync<TApp>(CommandLineContext context)
where TApp : class
=> Task.FromResult(Execute<TApp>(context));
As you may well know, this method uses Task.FromResult to wrap a slew of synchronous calls in a task. This is inherently synchronous and effectively just deceives the consumer into thinking that their commands will execute asynchronously.
Expected behavior Instead of wrapping synchronous code, the asynchronous execution should have its own separate async path.
I’ve logged this as a bug because the methods exist, but I realize that with the amount of work necessary to remediate, this is likely a feature request.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Why is this async function is running synchronously?
Promises are used to deal with asynchronous behavior, but there's nothing inherently asynchronous about the content of the test function.
Read more >Sync, Async, and Colorless Functions?
I guess there's some backlash against things like Python's async ... a function as being inherently either synchronous or asynchronous?
Read more >Should I expose asynchronous wrappers for synchronous ...
Async wrappers around sync methods have overhead (e.g. allocating the object to represent the operation, context switches, synchronization ...
Read more >Why don't programming languages automatically manage ...
Async code has very deep effects for the execution model of a language ... While asynchronous programming is inherently, well, asynchronous, ...
Read more >What is Asynchronous and What Does it Mean?
JavaScript is another example of a mode of communication that is inherently synchronous but has been modified to be asynchronous to enable programs...
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
Stale-bot closed this, but I’m reopening because I think this is worth fixing.
Oddly enough, I just read your Deep-dive into .NET Core primitives a few days ago and it reminded about this issue (author, not subject matter). I’m glad you took it on.