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

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

Open
jonmdev opened this issue Dec 18, 2024 · 2 comments

Comments

@jonmdev
Copy link

jonmdev commented Dec 18, 2024

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

@Zhanglirong-Winnie
Copy link

Zhanglirong-Winnie commented Dec 18, 2024

This issue has been verified using Visual Studio 17.13 preview 2 (9.0.12 & 9.0.0 & 8.0.100 & 8.0.83 & 8.0.3). Can repro this issue on Samsung Android device and emulator platforms. The problem reappears in both .NET9 and .NET8.

@jfversluis jfversluis transferred this issue from dotnet/maui Dec 18, 2024
@dotnet-policy-service dotnet-policy-service bot added the needs-triage Issues that need to be assigned. label Dec 18, 2024
@jpobst
Copy link
Contributor

jpobst commented Dec 18, 2024

From my testing, this seems to work correctly using net9.0-android in Visual Studio 17.12.3 but does not work in Visual Studio 17.13 Preview 2. If this is the same thing others are seeing, then it feels like an issue with VS 17.13 P2.

Thus this issue likely occurs in the Visual Studio integration, which is owned by a different team who does not use GitHub for issue tracking.

Please use the tools available inside of VS to report this issue. This allows the issue to be routed to the correct team, and provides them the correct logs they need to diagnose it.

Definitely let them know that is it a VS 17.13 Preview regression and that it works in VS 17.12.3.

@jpobst jpobst removed the needs-triage Issues that need to be assigned. label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants