question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CommandLineApplication.ExecuteAsync is inherently synchronous

See original GitHub issue

Describe 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:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
natemcmastercommented, Jul 16, 2019

Stale-bot closed this, but I’m reopening because I think this is worth fixing.

1reaction
rlvandaveercommented, Jul 29, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found