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

Blazor WebAssembly Standalone App targeting .net 9 runs in production mode when started from VS in debug mode #57941

Closed
1 task done
emil-void opened this issue Sep 18, 2024 · 0 comments · Fixed by #57971
Closed
1 task done
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Milestone

Comments

@emil-void
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I create new Blazor WebAssembly Standalone App template project in Visual Studio 17.12.0 Preview 2.0, targeting .net 9 using the 9.0.100-rc.1.24452.12 version of .net SDK

Then I slightly change the 'Home' page in the 'Pages' folder of the project to display the environment as follows:

@page "/"
@using Microsoft.AspNetCore.Components.WebAssembly.Hosting
@inject IWebAssemblyHostEnvironment Env

<PageTitle>Home</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.

<p>Environment: @Env.Environment</p>

Now, when I run the project in VS debug mode, I get this result

image

indicating, that the project runs as in production environment (not correct IMO), even though the generated launchSettings.json sets the 'ASPNETCORE_ENVIRONMENT' as 'Development'

"https": {
  "commandName": "Project",
  "dotnetRunMessages": true,
  "launchBrowser": true,
  "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
  "applicationUrl": "https://localhost:7299;http://localhost:5176",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
}

When I follow the exact steps in the same Visual Studio using the same .net SDK version with the only difference - targeting .net 8 (instead of .net 9) I get this:

image

The environment is 'Development' which I tend to consider as correct behavior

Expected Behavior

Running Blazor WebAssembly Standalone App project from VS in 'debug' mode with

"ASPNETCORE_ENVIRONMENT": "Development"

set in launchSettings.json

should set the environment to 'Development' instead to 'Production'

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

9.0.100-rc.1.24452.12

Anything else?

.NET SDK:
Version: 9.0.100-rc.1.24452.12
Commit: 81a714c6d3
Workload version: 9.0.100-manifests.67cd1eb6
MSBuild version: 17.12.0-preview-24422-09+d17ec720d

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants