Skip to content

[release/7.0.2xx] System.NullReferenceException when running dotnet watch run #29085

@MichaelSimons

Description

@MichaelSimons

Repro Steps

  1. Install 7.0.2xx build. I'm running
.NET SDK:
 Version:   7.0.200
 Commit:    1e1965db1f
  1. mkdir temp
  2. dotnet new console -o temp
  3. cd temp
  4. dotnet watch run

Results

dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
  💡 Press "Ctrl + R" to restart.
dotnet watch 🔧 Building...
  Determining projects to restore...
  All projects are up-to-date for restore.
  temp -> /repos/temp/bin/Debug/net7.0/temp.dll
dotnet watch ❌ System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.DotNet.Cli.EnvironmentVariableNames.TryParseArchitecture(String runtimeIdentifier, Architecture& architecture)
   at Microsoft.DotNet.Cli.EnvironmentVariableNames.TryGetDotNetRootVariableNameImpl(String runtimeIdentifier, String defaultAppHostRuntimeIdentifier, Version targetFrameworkVersion, Architecture currentArchitecture, Boolean is64bit)
   at Microsoft.DotNet.Cli.EnvironmentVariableNames.TryGetDotNetRootVariableName(String runtimeIdentifier, String defaultAppHostRuntimeIdentifier, Version targetFrameworkVersion)
   at Microsoft.DotNet.Watcher.HotReloadDotNetWatcher.ConfigureExecutable(DotNetWatchContext context, ProcessSpec processSpec)
   at Microsoft.DotNet.Watcher.HotReloadDotNetWatcher.WatchAsync(DotNetWatchContext context, CancellationToken cancellationToken)
   at Microsoft.DotNet.Watcher.Program.MainInternalAsync(CommandLineOptions options, CancellationToken cancellationToken)
   at Microsoft.DotNet.Watcher.Program.MainInternalAsync(CommandLineOptions options, CancellationToken cancellationToken)
   at Microsoft.DotNet.Watcher.Program.HandleWatch(CommandLineOptions options)
dotnet watch ❌ An unexpected error occurred

Notes:
source-build unit tests caught this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions