Skip to content

dotnet watch run does not read appsettings.Development.json when --project is used #23183

Closed
@HymanZHAN

Description

@HymanZHAN

Describe the bug

dotnet watch run will not read appsettings.Development.json of the child project when the --project flag is passed and used. It will use the production appsettings.json instead.

To Reproduce

Repro repo: https://github.com/HymanZHAN/DotnetWatchBug
Reproduction instructions are included in the README.

Exceptions (if any)

watch : Started
config token key: 
Unhandled exception. System.ArgumentNullException: String reference not set to an instance of a String. (Parameter 's')
   at System.Text.Encoding.GetBytes(String s) in /builddir/build/BUILD/dotnet-9e8b04bbff820c93c142f99a507a46b976f5c14c/src/runtime.4822e3c3aa77eb82b2fb33c9321f923cf11ddde6/artifacts/source-build/self/src/src/libraries/System.Private.CoreLib/src/System/Text/Encoding.cs:line 665
   at System.Text.UTF8Encoding.UTF8EncodingSealed.GetBytes(String s) in /builddir/build/BUILD/dotnet-9e8b04bbff820c93c142f99a507a46b976f5c14c/src/runtime.4822e3c3aa77eb82b2fb33c9321f923cf11ddde6/artifacts/source-build/self/src/src/libraries/System.Private.CoreLib/src/System/Text/UTF8Encoding.Sealed.cs:line 43
   at API.Extensions.IdentityServiceExtensions.AddIdentityServices(IServiceCollection services, IConfiguration config) in /home/xzhan/Development/Projects/DotnetWatchBug/API/Extensions/IdentityServiceExtension.cs:line 10
   at Program.<Main>$(String[] args) in /home/xzhan/Development/Projects/DotnetWatchBug/API/Program.cs:line 11
watch : Exited with error code 134
watch : Waiting for a file to change before restarting dotnet...
watch : Shutdown requested. Press Ctrl+C again to force exit.

Further technical details

  • Include the output of dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     fedora
 OS Version:  35
 OS Platform: Linux
 RID:         fedora.35-x64
 Base Path:   /usr/lib64/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  5.0.206 [/usr/lib64/dotnet/sdk]
  6.0.100 [/usr/lib64/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.9 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.9 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
VS Code 1.63.2
899d46d82c4c95423fb7e10e68eba52050e30ba3
x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-AspNetCoreRazorSDK, BlazorWebAssemblySDK, dotnet-watchuntriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions