question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android "No compatible code running on the thread" and crash after hit continue

See original GitHub issue

Description

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 image

image

Visual Studio Version: image image image image

Steps to Reproduce

  1. Create a new Dotnet Maui application with donet 8 preview 6
  2. Add a listview into the “MainPage.xaml” like follows: image
  3. Create the event ListView_ItemSelected like follows and add a break point image
  4. Hit F5 to run the app in the android emulator
  5. Click on one element of the item list image Then an error shown in Visual Studio: image

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:closed
  • Created 2 months ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Rabosa616commented, Jul 20, 2023

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

0reactions
moljaccommented, Jul 20, 2023

Citation was from the discord channel

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found