Skip to content

Debug.WriteLine() in Android .NET 9 no longer creates any output (regression, previously working in .NET 8) #9628

@jonmdev

Description

@jonmdev

Description

Since updating to .NET 9 I have seen I am not getting anything showing from Debug.WriteLine() when I run Android on a local device by USB in Debug mode.

To verify this, I created a simple project which is the base .NET 9 project with just the following added to App.xaml.cs:

IDispatcherTimer timer = Application.Current.Dispatcher.CreateTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += delegate {
    Debug.WriteLine("SECOND PASSED: " + DateTime.UtcNow.Second);
};
Debug.WriteLine("START TIMER");
timer.Start();

In Windows I see the START TIMER and SECOND PASSED: output easily in my Output section of Visual Studio. But with an attached Samsung Android device and debugging to that, I do not see any such output anymore.

The same Android device allows Debug.WriteLine() to work with similar code in .NET 8, so this is not a device issue. Rather, I believe this is a .NET 9 issue.

Obviously we need Debug.WriteLine() to figure out issues as we are coding in Android so this would be very helpful to have fixed.

Steps to Reproduce

Open demo project, run in Debug mode in Windows and Android to device, see output in Windows only.

Link to public reproduction project repository

https://github.com/jonmdev/AndroidDotNet9DebugBug

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.0-preview.1.7762

Affected platforms

Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    vs-syncFor internal use only; creates a VSTS "mirror" issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions