Reputation: 139
I have been working on a MAUI android application and when debugging, the breakpoints is not hitting and the application enter in a break state. But for windows app it works well. I think this is an issue with the .NET 6 Android Tooling in visual studio 2022. Is there any solutions for this problem ?
Upvotes: 5
Views: 4402
Reputation: 1576
I had the same problem and it is now working, try this:
Windows -> Settings -> Update & Security -> For Developers -> Developer Mode - On
Visual Studio -> Tools -> Options -> Xml Hot Reaload -> Disable all
Upvotes: 1
Reputation: 905
I was also having problems debugging some projects. (Preview 17.1.0) The ones that were failing had the following project settings.
<PropertyGroup>
<TargetFrameworks>net6.0-ios;net6.0-android;net6.0-maccatalyst</TargetFrameworks> ...
Moving Android first fixed my problem
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks> ...
Upvotes: 1
Reputation: 641
Here is a few steps I did to make things work with debugging MAUI Android apps. I was able to debug and get my regular exceptions and hit breakpoints after this.
Add this code to Android platform main activity OnCreate method
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Then this hander method in the same class
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{ System.Diagnostics.Debug.WriteLine(e.ToString());}
Reset Your Exceptions for CLR. Shortcut is (Ctrl+Alt+E).
Just double-click on the CLR Exceptions checkbox to reset.
Upvotes: 3