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.

Passing program arguments with dotnet run fails with the option -d (6.0.100-preview.1.21103.13)

See original GitHub issue

Passing command line arguments to the application with dotnet run doesn’t show an argument passed if the argument -d is passed.

Application with top-level statements:

System.Console.WriteLine($"length: {args.Length}");

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <Nullable>enable</Nullable>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

</Project>

Running the application with

dotnet run -- -a

is as expected. Using

dotnet run -- -d

give this argument count: 0.

The issue happens when this SDK is used (on Windows): 6.0.100-preview.1.21103.13

Creating a global.json file and set the version number to 5.0.103, the program runs as expected.

I’m running Windows 10, build 21322.1000

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sfoslundcommented, Jul 20, 2021

Yup, thanks, simple fix out here: https://github.com/dotnet/sdk/pull/19086

1reaction
gingterscommented, Jul 1, 2021

@joeloff I also can reproduce this bug. You should change ‘for consideration’ to bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Christian Nagel
Passing program arguments with dotnet run fails with the option -d (6.0.100-preview.1.21103.13) ·... Passing command line arguments to the application with ...
Read more >
Chocolatey Software | FAKE - F# Make 5.21.1
Some Checks Have Failed or Are Not Yet Complete ... Verification Testing Passed ... run the following command from the command line or...
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