Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in argument handling in dotnet run between 9.0.103 and 9.0.200 #46912

Open
mareklinka opened this issue Feb 18, 2025 · 0 comments
Open
Labels
Area-WebSDK untriaged Request triage from a team member

Comments

@mareklinka
Copy link

Describe the bug

There seems to be a regression/change of behavior in how dotnet run handles command line arguments.

I have an ASP.NET core application targeting .NET 9. We have migrated from SDK 9.0.103 to 9.0.200 last week and immediately started having issues with our test pipelines. I tracked the issue to the behavior of dotnet run.

Our command line: dotnet run --environment UiTests --urls https://localhost:7139

In 9.0.103, this produced the following output (parts omitted for brevity):

Using launch settings from [path]\launchSettings.json...
Building...
[11:57:51 INF] User profile is available. Using '[user profile]\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
[11:57:52 WRN] The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see https://aka.ms/aspnet/https-trust-dev-cert
[11:57:52 INF] Now listening on: https://localhost:7139
[11:57:52 INF] [app] application 'Started'
[11:57:52 INF] Application started. Press Ctrl+C to shut down.
[11:57:52 INF] Hosting environment: UiTests
[11:57:52 INF] Content root path: [root path]

In 9.0.200, this has changed:

Using launch settings from [path]\launchSettings.json...
Building...
[11:59:36 INF] User profile is available. Using '[user profile]\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
[11:59:37 WRN] The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see https://aka.ms/aspnet/https-trust-dev-cert
[11:59:37 INF] Now listening on: https://localhost:7139
[11:59:37 INF] [app] application 'Started'
[11:59:37 INF] Application started. Press Ctrl+C to shut down.
[11:59:37 INF] Hosting environment: Development
[11:59:37 INF] Content root path: [root path]

Note the difference in Hosting environment. It looks like in 9.0.200, the --environment was not passed to the application being run.

If I change the command line to dotnet run -- --environment UiTests --urls https://localhost:7139, we get the expected output:

Using launch settings from [path]\launchSettings.json...
Building...
[12:02:14 INF] User profile is available. Using '[user profile]\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
[12:02:14 WRN] The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see https://aka.ms/aspnet/https-trust-dev-cert
[12:02:14 INF] Now listening on: https://localhost:7139
[12:02:14 INF] [app] application 'Started'
[12:02:14 INF] Application started. Press Ctrl+C to shut down.
[12:02:14 INF] Hosting environment: UiTests
[12:02:14 INF] Content root path: [root path]

I wasn't able to find any documentation about this change, in fact, this documentation still contains the old format without the -- separator. Is this change expected? If so, I think this is a breaking change that should be documented somewhere. If not, I guess this is a bug report.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-WebSDK untriaged Request triage from a team member labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-WebSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant