This report is motivated by a secondary symptom I encountered when attempting to reproduce https://github.com/xamarin/xamarin-android/issues/3222.
I'm not sure yet where the root of this problem is. One thought I had based on the involvement of Android.OS.AsyncTask was that it might involve the Java interop layer. But I'll submit it here in Mono first based on a guess that it might be possible to fix the issue by adjusting the debugger in some way.
AsyncTask1.RunInBackground() (at MainActivity.cs line 16).Test case: RepeatedBreakpointAsyncTask.zip
(This is just a new template Xamarin.Android app with a minimal example AsyncTask.)
On one of the repetitions of step 6, Visual Studio opens a Break Mode tab that says:
No compatible code running
The selected debug engine does not support any code executing on the current thread (e.g. only native runtime code is executing).
When that happens, Visual Studio doesn't highlight the current execution line in the editor or show any information in the Call Stack window.
(In Visual Studio for Mac, there isn't a Break Mode tab, but the other behaviors are the same.)
The number of repetitions of step 6 to see the behavior varied for me across devices:
Android 7.1 Nougat (API level 25) armeabi-v7a, Motorola Moto E4
So far always 4.
Android 7.1 Nougat (API level 25) x86, Google APIs emulator (system-images;android-25;google_apis;x86)
So far always 3.
Android 7.1 Nougat (API level 25) x86_64, Google APIs emulator (system-images;android-25;google_apis;x86_64)
So far always 3.
Android 9.0 Pie (API level 28) arm64-v8a, Google Pixel 3:
So far always 5.
Android 10 (API level 29) x86_64, Google Play emulator (system-images;android-29;google_apis_playstore;x86_64):
Usually 2. Sometimes 3.
Perhaps also interesting, the new System.Threading.Thread(() => { }).Start() line in the test case was only needed for this Android 10 x86_64 emulator. On the other devices and emulators, I could remove that line and still reproduce the issue.
The first time the breakpoint is hit, the debugger behaves as expected. For example, Visual Studio highlights the current execution line in the editor, and Debug > Step Over allows stepping to the next line.
[x] Xamarin.Android
Version Used:
Visual Studio 2019 version 16.5 IntPreview
16.5.0-pre.2.0+29608.14.master
Mono Debugging for Visual Studio 16.5.506 (c3636c8)
Xamarin 16.5.000.363 (d16-5@a40bf8d)
Xamarin.Android SDK 10.2.0.16 (d16-5/48f0fe7), which uses mono/mono/2019-08@062f0ab8cae60d1d347e4d722884c065c9f34484
Not a recent regression:
I was able to reproduce the same behavior with Visual Studio 2019 version 16.1.6.
Mono Debugging for Visual Studio 16.1.1 (2473f22)
Xamarin 16.1.0.545 (d16-1@db7c858e8)
Xamarin.Android SDK 9.3.0.23 (monodroid/d16-1@d0b48056f), which uses mono/mono/2018-08@3a07bd426d3dae0d9b6c7891e7bb11f487b18484
/cc @lambdageek
Likely related reports (oldest to newest):
Regression between Visual Studio 2017 version 15.9 and Visual Studio 2019 version 16.1:
After seeing these Visual Studio Developer Community reports, I thought it would be interesting to check the behavior of this test case on Visual Studio 2017 too.
Indeed, I was not able to reproduce this problem in Visual Studio 2017 version 15.9. I performed at least 12 repetitions of steps 4 and 5 on each of the following devices, and the breakpoint worked as expected every time.
system-images;android-25;google_apis;x86)system-images;android-25;google_apis;x86_64)system-images;android-29;google_apis_playstore;x86_64):Next steps:
I will try a few experiments to see if I can narrow down which specific component has changed behavior.
The change in behavior was introduced between:
mono/2018-06@b63e5378e389f675640fba97999b82f3ca7a44c2
and
mono/2018-08@9f72a46b41fc8985a1062275f90b57fb54f01347
Steps tested:
Results with libraries from mono/2018-06@b63e5378:
The breakpoint always behaved as desired.
Results with libraries from mono/2018-08@9f72a46b:
The No compatible code running window appeared.
I'm facing this exact issue since upgrading my xamarin forms app to VS2019, but only happens for the Android version of the app; iOS version hits break points just fine.
Any ETA on the fix? Or do you suggest to manually revert to a previous versions of the mono and mscorlib?
Keeping open until the backports land
Release status update
A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
The fix is not yet available on macOS. I will update this item again when a Preview version with the fix is available on macOS.
Fix included in Xamarin.Android 10.2.0.99.
Fix included on Windows in Visual Studio 2019 version 16.5 Preview 3. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix not yet available on macOS.
Release status update
A new Preview version of Xamarin.Android has now been published on macOS that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 6. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.5 Preview 3 and higher. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.)
Release status update
A new Release version of Xamarin.Android has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on Windows in Visual Studio 2019 version 16.5. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.
(Fix also included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 6 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.)
Release status update
A new Release version of Xamarin.Android has now been published on macOS that includes the fix for this item.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on macOS in Visual Studio 2019 for Mac version 8.5. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.5 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.)
I've been observing similar errors for a while now - not sure if it started with VS 16.5 or one of its updates. VS 16.6 also has the same problem.
Debugging android stops on breakpoints but says that no compatible code is running. this code comes from another package that we build, and this has never been an issue beforehand. The same breakpoint works fine when running a different platform like UWP.
This has made debugging on android pretty much impossible as most of the actual logic lives in the shared package across platforms.
Any ideas on how to diagnose this?
@MitchBomcanhao exactly the same situation.
We have setup external packages and they can no longer debug or breakpoints resolved. I do believe this started in 16.5.0, it's annoying as it's impossible to debug Xamarin issues in our projects now.
Does anyone has an open-source project that can tell me where to set the breakpoint then I can use it to reproduce?
I have been trying to resolve the same issue. Just updated to VS 2019 V16.5 in the hopes it would fix the problem. Building and debugging an Xamarin Android app is now very difficult. I did all of the standard things including deleting the .obj and .bin files from the project, reloading it and restarting (as suggested on another thread) but still results are the same. I am now running a "repair" on my VS instance to see if that makes any difference.
Can anyone help me to reproduce it?
Yes. The project built and ran correctly in vs 2017
In 2019 the breakpoints are not hit. When I insert one programmaticly it
breaks but I get the incomparable code message. Breakpoints set in vs are
ignored
On Thu, May 14, 2020, 2:35 PM Thays Grazia notifications@github.com wrote:
Can anyone help me to reproduce it?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/mono/mono/issues/18106#issuecomment-628815158, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/APSWDJTNIRLZEJX4S7EGMQLRRQ2WVANCNFSM4JY2AOIA
.
This is happening in any simple project? Running in an emulator or in the device?
Any sample project, emulated or physical device
All work fine in VS 2017
VS is running on windows 10. I just updated the VS 2019 today to the
current rev hoping that would address the problem as stated in the forum.
Jeff Schwartz
Chief Technical Officer
Symptelligence Medical Informatics LLC
On Thu, May 14, 2020 at 3:22 PM Thays Grazia notifications@github.com
wrote:
This is happening in any simple project? Running in an emulator or in the
device?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/mono/mono/issues/18106#issuecomment-628839292, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/APSWDJUBB3HWNBWPEYLDD2LRRRAHFANCNFSM4JY2AOIA
.
Breakpoints are not working in emulator or when physical device attached. All breakpoints set in VS are ignored, Symbols are loaded, breakpoints set with no errors. I can force a break by inserting a call to Debugger.Break(); to force a breakpoint but that only generates the "no compatible code running message.
Below is the configuration I have loaded on my development machine:
Microsoft Visual Studio Community 2019
Version 16.5.5
VisualStudio.16.Release/16.5.5+30104.148
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Community
Azure App Service Tools v3.0.0 16.5.236.49856
Azure App Service Tools v3.0.0
C# Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
GitHub.VisualStudio 2.11.96.24460
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Mono Debugging for Visual Studio 16.5.514 (c4f36a9)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Visual Basic Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.8.0.0 for F# 4.7 16.5.0-beta.20181.6+85af456066acd4e76d2bc7821b44a325e46f2fca
Microsoft Visual F# Tools 10.8.0.0 for F# 4.7
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Foo 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 16.5.000.533 (d16-5@9152e1b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.5.0.470 (remotes/origin/d16-5@681de3fd6)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.5.49 (0904f41)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 10.2.0.100 (d16-5/988c811)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: c0c5c78
Java.Interop: xamarin/java.interop/d16-5@fc18c54
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b
Xamarin.iOS and Xamarin.Mac SDK 13.16.0.13 (b75deaf)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
This issue was about getting "No Compatible code running" message when trying to debug async code.
This is the other issue https://developercommunity.visualstudio.com/content/problem/998764/xamarin-ios-breakpoints-not-working-in-a-custom-nu.html that is about getting "No compatible code running" when trying to debug external code.
So I'll keep this issue closed.
Thank you for your kind response. However I am NOT debugging external code. Breakpoints are not occurring in my project code. I am setting breakpoints in my application, not in the external package.
Hi, @jeffjag681 , could you create a project and share it on github that we can reproduce?
I tried a lot to reproduce it, I'm with the same version as you are and I cannot get the same message.
Interesting....I can try that and will post it. I also have VS2017 installed, should I uninstall this version?
I don't think so, I have both installed here too.
Thanks for all your help. I just built the simplest project I could build. Just a raw Xamarin Android app. Here the breakpoints are hit. so while this doesn't solve the issue. It does clarify that it is not directly caused by Visual Studio 2019 V16.5. Now the question is what configuration or other items could cause this to occur. I would post it but the zip file is too large.
I notice in my project that fails to break that when I look in Debug->Windows->Modules, I see that symbols are loaded for the project but it extension for the file is .mdb, not .pdb My configuration is set to debug and exceptions are set to the default settings. Could this be an indication of what the problem is?
Maybe it's an indication. If you have control over the code creating that dll/symbols, switch the DebugType to Portable (it will be Full right now). Portable in general works way better than Full. It's a more modern (and better supported) format.
Done. Now it loads the PDB file as expected, but the behavior is the same. Breakpoint is ignored. I inserted a call to Debugger.break; just above my breakpoint to verify that the code is following the expected path and it hits that fine. But still comes up with "no compatible code running"
I did port this code over from VS 2017 and then had issues building it. But that was resolved by installing Xamarin into my 2019 configuration.
Can you copy your callstack on the break? At least the first few lines, until you see something you can recognize, and with "External Code" enabled (you can enable/disable it by right-clicking on the call stack). Also, go watch build! :)
Here is the call stack:
0x22 in weShareAndroid.TrackTimeFragment.OnCreateView C#
0x26 in Android.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ C#
0x23 in Android.Runtime.DynamicMethodNameCounter.22 C#
The part I'm most interested here is the file path of those frames, if you can see it in the stack. And then if that path makes sense to you, and if you have those files in those places.
I notice when I try to copy with source paths I don't get any additional information. However when I look at the break point itself it is pointing to the correct file and line and source and indicates that is it set (solid red dot)
I have another clue as to what is happening (but not a solution) When I set
a breakpoint in my code (I have updated to 16.6) I notice that I get a
build error that the resource layout does not contain a definition for the
fragment or activity where the breakpoint is set. The build error goes
away when I remove the breakpoint.
Jeff Schwartz
Chief Technical Officer
Symptelligence Medical Informatics LLC
On Tue, May 19, 2020 at 11:53 AM Joaquin Jares notifications@github.com
wrote:
The part I'm most interested here is the file path of those frames, if you
can see it in the stack. And then if that path makes sense to you, and if
you have those files in those places.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mono/mono/issues/18106#issuecomment-630912437, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/APSWDJVNZLSEIYQEA2FKPN3RSKTQFANCNFSM4JY2AOIA
.
You mean like an xml build error? That shouldn't happen at all :)
Agreed, but that is what I am seeing. This did not happen in vs 2017. I
can load and build the project there and it works fine with all breakpoints
functioning g
On Wed, May 20, 2020, 11:20 AM Joaquin Jares notifications@github.com
wrote:
You mean like an xml build error? That shouldn't happen at all :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mono/mono/issues/18106#issuecomment-631542586, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/APSWDJWSXYSGJJ3TPCREO7TRSPYKLANCNFSM4JY2AOIA
.
it seems I still get
No compatible code running
The selected debug engine does not support any code executing on the current thread (e.g. only native runtime code is executing).
when trying to debug xamarin.forms code.
it hit the break point in XF code, but shows that message. and cannot step into/over.
pdb file is loaded.
"Enable just my code" is unchecked.
Microsoft Visual Studio Enterprise 2019
Version 16.6.3
VisualStudio.16.Release/16.6.3+30225.117
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Enterprise
ASP.NET and Web Tools 2019 16.6.954.58314
ASP.NET and Web Tools 2019
ASP.NET Core Razor Language Services 16.1.0.2020603+b3ac44798c16fff5b95dbcfe62dea84aa9a1bd72
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2019 16.6.954.58314
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.6.954.58314
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 16.6.954.58314
Azure Functions and Web Jobs Tools
C# Tools 3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
JetBrains ReSharper Ultimate 2019.2.3 Build 192.0.20191016.60459
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2020 JetBrains, Inc.
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30212.1
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.1.50+g25aae5a24a.R
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Mono Debugging for Visual Studio 16.6.17 (9692114)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info
SonarLint for Visual Studio 4.22.0.18519
SonarLint is an extension to your favorite IDE that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.
SQL Server Data Tools 16.0.62006.03190
Microsoft SQL Server Data Tools
TypeScript Tools 16.0.20417.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.9.1.0 for F# 4.7 16.6.0-beta.20217.4+1c969cac25e2d38d71872efe6c8226029e42bb59
Microsoft Visual F# Tools 10.9.1.0 for F# 4.7
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions (Preview) 1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Foo 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 16.6.000.1062 (d16-6@41e1f0e)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.6.0.318 (remotes/origin/d16-6@66afc5421)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.6.40 (1f1466f)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 10.3.1.4 (d16-6/3a10de9)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.31.1@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3
Xamarin.iOS and Xamarin.Mac SDK 13.18.2.1 (29c4ea7)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
@bill2004158, if you get a chance, I'd recommend submitting a new Visual Studio Developer Community feedback item via Help > Send Feedback > Report a Problem in Visual Studio for the behavior you are seeing. That will allow a dedicated discussion for your specific scenario. Feedback items submitted via Visual Studio also allow private attachments, which might be useful in this case for sharing details about your scenario.
Thanks in advance!