Android "No compatible code running on the thread" and crash after hit continue
See original GitHub issueDescription
After I created a new project with Dotnet Maui 8 preview 6 I get the following error on Android when I try to debug the event ItemSelected on a ListView control
Visual Studio Version:
Steps to Reproduce
- Create a new Dotnet Maui application with donet 8 preview 6
- Add a listview into the “MainPage.xaml” like follows:
- Create the event ListView_ItemSelected like follows and add a break point
- Hit F5 to run the app in the android emulator
- Click on one element of the item list
Then an error shown in Visual Studio:
Link to public reproduction project repository
https://github.com/Rabosa616/MauiAndroidBug
Version with bug
8.0.0-preview.6.8686
Last version that worked well
7.0.49
Affected platforms
Android
Affected platform versions
Android 12.1 , Android 13
Did you find any workaround?
No response
Relevant log output
monodroid.log:
MonoDroidLog: Information: 0: [I:]: Found Xamarin.Android 13.2.0.13
MonoDroidLog: Information: 0: [I:sdk]: Runtime path: C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Xamarin\Android
MonoDroidLog: Information: 0: [I:sdk]: Framework path: C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0
MonoDroidLog: Information: 0: [I:]: Looking for Android NDK...
MonoDroidLog: Information: 0: [I:]: Looking for Android SDK...
MonoDroidLog: Information: 0: [I:]: Tracking android devices started
MonoDroidLog: Warning: 0: [W:]: Adb connection refused
MonoDroidLog: Information: 0: [I:]: Starting Adb server (adb start-server)
MonoDroidLog: Information: 0: [I:]: Adb start-server operation completed
MonoDroidLog: Information: 0: [I:]: Got new device list from adb with 0 devices
MonoDroidLog: Information: 0: [I:]: Looking for Android SDK...
MonoDroidLog: Information: 0: [I:]: Got new device list from adb with 1 devices
MonoDroidLog: Information: 0: [I:]: Got new device list from adb with 1 devices
MonoDroidLog: Error: 0: [E:RunShellCommand]: emulator-5554 logcat -v time failed: Mono.AndroidTools.AdbException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.IO.IOException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action`1 output, Func`1 predicate) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 585
--- End of inner exception stack trace ---
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action`1 output, Func`1 predicate) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 592
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass119_0.<RunShellCommandAsync>b__0() in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 1021
MonoDroidLog: Error: 0: [E:RunShellCommand]: emulator-5554 logcat -v time "dalvikvm:S" "ActivityThread:S" "mkestner:S" "MonoDroid-Debugger:S" failed: Mono.AndroidTools.AdbException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.IO.IOException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action`1 output, Func`1 predicate) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 585
--- End of inner exception stack trace ---
at Mono.AndroidTools.Adb.AdbClient.ReadLineWhile(Action`1 output, Func`1 predicate) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 592
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass119_0.<RunShellCommandAsync>b__0() in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 1021
Issue Analytics
- State:
- Created 2 months ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Xamarin Android debugging: No compatible code running
Just continue, then look through the Output, it will show you the stack trace of the exception. It is a good idea to...
Read more >What should I do if my debugger is malfunctioning?
I recently started writing code for an android app in visual studio ... I get an error saying "no compatible code running on...
Read more >no compatible code running - Developer Community
I'm usgin VS Community 2017 and Xamarin Forms. When I try to create custom renderer for android I receive this error.
Read more >No compatible code running on the thread
I hit F5 and receive error "No compatible code running on the thread" https://github.com/proficad/MauiApp2.App.
Read more >Debugging No compatible code running - Android
I get a Microsoft.Xna.Framework.Content.ContentLoadException: 'The content file was not found.' Exception. But I get a No compatible code ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve find out that: https://developercommunity.visualstudio.com/t/Not-running-compatible-code-on-the-threa/10370046
After updating to Visual Studio Version 17.7.0 Preview 4.0 the issue is fixed
Citation was from the discord channel