A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hi @Giorgio Sfiligoi ,
Thanks for reaching out.
From the code and error you provided, the problem is caused by the fast loop flooding the debug output window.
Rapid Debug.WriteLine calls overwhelm the debugger connection on the Android emulator (especially API 36), causing it to freeze or crash Visual Studio. This doesn't happen on Windows or real phones because their debug channels handle it better.
I recommend some sulutions below:
First, try to add a small delay inside the loop:
[RelayCommand]
public async Task Test()
{
for (int i = 0; i < 200; i++)
{
Debug.WriteLine($"i = {i}");
await Task.Delay(5); // or 10 – just enough to slow output
}
}
Then rebuild and run.
Extra tips if still issues:
- Update Visual Studio to latest.
- Try a lower API emulator (e.g. API 34 or 33) – newer APIs can be unstable for heavy debug output.
- Check Output window for clues before crash.
This is a known emulator/debugger limitation, not your code bug.
Hope this helps. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance provide feedback. Thank you.