Closed arttsai closed 5 months ago
Sorry, I found the reason. I forgot to use 'await'
original:
var result = Parser.Default.ParseArguments<Option>(args)
.WithParsedAsync(RunAsync);
change to:
var result = await Parser.Default.ParseArguments<Option>(args)
.WithParsedAsync(RunAsync);
will fix the problem.
I'll close this issue.
My small program stops execution in a for loop without any error. At first glance I thought there might be a problem in dotnet runtime. But after rewriting the program without using command line parser, the program behave normally.
This is weird. I don't think a package could affect the execution. This small project only use a package: command line parser. So I think I should report this scenario.
Describe the bug I don't know if this is a bug from command line parser. But in my code, the for loop stop execution without error nor exception. At the first glance I thought the compiler might has some problem. But another branch which doesn't use command line parser can execute without any problem.
To Reproduce This is a small project.
Please see the repository (master branch) https://github.com/arttsai/Mywc. When executing the program, in CountDirectoryAsync(), line 48 (for loop). this for loop might only run 1 or 2 times and then the program terminates without any error.
With branch PureWc, which doesn't use command line parser, the program executes perfectly.
When executing either branch, you need to give command line arguments.
Expected behavior Find out the reason why the for loop stops. Find out if command line parser affect the program execution.
Screenshots None.
Additional context None.