Skip to content

dotnet run console behavior #10645

@jonathanpeppers

Description

@jonathanpeppers

Android framework version

net10.0-android (Preview)

Affected platform version

.NET 10

Description

If I attempt dotnet-watch on a dotnet new maui-blazor template:

> dotnet watch -f net10.0-android
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch 💡 Press Ctrl+R to restart.
dotnet watch 🔨 Building D:\src\hellomauiblazor\hellomauiblazor.csproj ...
dotnet watch 🔨 Build succeeded: D:\src\hellomauiblazor\hellomauiblazor.csproj
Using launch settings from D:\src\hellomauiblazor\Properties\launchSettings.json...
Stopping: com.companyname.hellomauiblazor
Starting: Intent { cmp=com.companyname.hellomauiblazor/crc64bb58be9762961ef6.MainActivity }
dotnet watch ⌚ [hellomauiblazor (net10.0-android)] Exited

It thinks the app exited because dotnet run completed and there is not console output.

For alignment with other platforms, including dotnet new console, dotnet run for Android should:

  • Show console output for the launched process
  • Exit if the app closes
  • Close the app on Ctrl+C

Implementation details

  • We need a new public $(WaitForExit) MSBuild property to get back to the existing behavior.
    • iOS already has $(_MlaunchWaitForExit)=false to do this.
  • We need to implement this in a way that:
    • $(RunCommand) and $(RunArguments) can be executed by dotnet run CLI
    • This may require a new Android console app/tool, depending on adb shell options.

Steps to Reproduce

  1. dotnet new android
  2. dotnet run

Metadata

Metadata

Labels

Area: App RuntimeIssues in `libmonodroid.so`.enhancementProposed change to current functionality.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions