locked
No compatible code running RRS feed

  • Question

  • User265133 posted

    I am using windows 8, Visual studio 2015. When trying to debug the program i get:

    No compatible code running

    The selected debug engine does not support any code executing on the current thead (e.g. only native runtime code is executing).

    Any solution?

    Thanks a lot!!

    Vasiu

    Thursday, October 13, 2016 1:18 PM

All replies

  • User13529 posted

    Hi @vasiuraphael, can you share a screenshot or something?

    Thursday, October 13, 2016 2:24 PM
  • User255973 posted

    I have.. both the screenshot and the error, unfortunately.

    https://i.imgur.com/bZxi9B3.png

    It happens when trying to step inside the Xamarin code. I was also asked to locate the file which it's trying to debug. Any ideas? I'm pretty new to Xamarin so maybe i haven't set debugging up correctly.

    The project I'm tying to get running is: https://github.com/michael-watson/particle-xamarin Straight out of git

    More info on my problem here: https://community.particle.io/t/particle-sdk-for-xamarin/21265/11?u=simoher

    PS I'm running Xamarin 7

    Tuesday, November 1, 2016 4:25 PM
  • User273939 posted

    I'm also suffering from this problem recently. It worked well before, I don't know why it doesn't show the codes where exception is raised but show 'No compatible code running', any resolution??

    Friday, January 13, 2017 6:21 AM
  • User267379 posted

    I am also facing this same problem while running on Xamarin Forms on Android Platform. If anyone resolved this problem mean let me know please.

    Another one issue, I am integrating multiple Content Views into a single Content Page in Xamarin Forms. While running it on Android Platform its thrown error and stopped running (But Its working well in IOS).

    Thanks.

    Monday, April 17, 2017 11:30 AM
  • User279540 posted

    Same error here. I have no clue what could be wrong, as it happens after my code runs on a page creation. Basically stepping through the code is fine end it throws the exception after the last code line... Also it is in a try catch section.. So where is the problem?!

    Thursday, April 27, 2017 9:49 PM
  • User300667 posted

    I'm getting this same error with Windows 10, Visual Studio 2017 and Xamarin Android custom page renderer. I'm implementing a WebView with a JavaScript Interface to call back into the C#. I can step through and debug... everything looks good. But it throws the "no compatible code running" exception at the very end. Anyone find a solution?

    Friday, June 9, 2017 5:19 PM
  • User309372 posted

    I had the same error message

    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).

    In my case, the problem was that I was missing some images under the Resources/Drawable directory.

    Adding the images solved my problem.

    The error message is very misleading and difficult to troubleshoot. I hope the Xamarin group improve the debugging messages.

    Tuesday, June 20, 2017 4:08 PM
  • User128730 posted

    I'm getting the same error message without showing the piece of code where error is occur . if somebody solve this please let me know as well. I'm using Visual Studio 2017 and Xamarin Forms.

    Thursday, November 23, 2017 1:18 PM
  • User350192 posted

    I'm also experiencing this error. Would love get a response from the Xamarin team. Also using VS2017 and Xamarin forms

    Tuesday, November 28, 2017 8:51 AM
  • User352157 posted

    Same here, on VS2017. Regardless of what the error is, I always get this popup that there is no compatible code running. Debugging anything is an actual pain in the ass.

    Tuesday, November 28, 2017 4:35 PM
  • User352157 posted

    Hey guys, I submitted a support ticket and got a call about this issue today. The repro we came up with/agreed on was that it occurs when there is an uncaught exception in any asynchronous code. My MainPage was being set from async code so any exceptions that occurred within the page resulted in the "No Compatible Code Running" screen. My current workaround is setting the MainPage within a Device.InvokeOnMainThread call. Then I could get exception info for any synchronous code in that page.

    Obviously this doesn't help you if your code HAS to be async, but they're looking into the issue.

    Monday, December 11, 2017 6:35 PM
  • User125633 posted

    I'm facing the same issue too. It's very frustrating. Looking forward to a solution.

    Thursday, December 21, 2017 10:44 PM
  • User125633 posted

    @nickcwilkins said: Hey guys, I submitted a support ticket and got a call about this issue today. The repro we came up with/agreed on was that it occurs when there is an uncaught exception in any asynchronous code. My MainPage was being set from async code so any exceptions that occurred within the page resulted in the "No Compatible Code Running" screen. My current workaround is setting the MainPage within a Device.InvokeOnMainThread call. Then I could get exception info for any synchronous code in that page.

    Obviously this doesn't help you if your code HAS to be async, but they're looking into the issue.

    I stripped my Android MainActivity's OnCreate() method of all codes except:

    protected override void OnCreate(Bundle bundle)
    {
        SetTheme(Resource.Style.MyTheme);
        base.OnCreate(bundle);
        SetContentView(Resource.Layout.Main);
    }
    

    The error still occurs. I don't know what else to do. There was no async method used.

    I also went ahead to remove SetContentView(Resource.Layout.Main); same outcome.

    Monday, December 25, 2017 9:20 PM
  • User332304 posted

    I had to do a bunch of things before I could fix this.

    1) Changed Minimum Android Level to 15 2) Checked Define TRACE Constant under build. 3) Changed Java Max Heap Size to 1G under Android options. It was blank originally. 4) Made sure that the Application name, theme and icons are appropriately filled under Android Manifest. 5) Replaced Assembly version in AssemblyInfo - from [assembly: AssemblyVersion("1.0.*")] to [assembly: AssemblyVersion("1.0.0.0")]
    6) Uninstalled the old project from the emulator. 7) Deleted bin and obj folders, 8) Unloaded, Reloaded the project 9) Cleaned and rebuilt the project

    Tuesday, January 16, 2018 5:11 PM
  • User143095 posted

    if this helps any 1, i did some code

    private static Page page;

    try { var answer = await page.DisplayAlert("Question?", "Would you like to play a game", "Yes", "No"); label.Text = answer.ToString(); }catch(Exception ee) { label.Text = ee.Message; }

    when running the code on my phone i got object not set error, obviously at the moment an update has set the error message in 2017 to be the same so i would add some try catch statements till they fix it.

    Tuesday, May 1, 2018 12:21 PM
  • User348888 posted

    Same problem here, did someone fixed it delete bin and obj not helping, what should I do

    Tuesday, July 10, 2018 11:13 AM
  • User378695 posted

    Uninstalling the app from Emulator did the trick for me. Also, I removed bin & obj folders before running the app. Thanks to @HowdyHo

    Tuesday, October 16, 2018 11:02 AM
  • User381248 posted

    I'm Using VS2017. I've faced the same issue. But now not. In my case I just made some changes in android options. They are, 1. In Linking properties - select SDK Assemblies only. 2. HTTP Client Implementation - Default

    Now its working.

    Tuesday, June 11, 2019 7:13 AM
  • User352419 posted

    I did as bdulwahabyounus and MAJoseph but it did not work either.

    The No compatible code running happens as I get Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. occurred

    My stack trace tells me that the problem occurs when doing a GoBackAsync():

    using Prism.Navigation;
    // ...
    
        private async void ExecuteNavigateCommand()
        {
            Shared.Status = Const.UNKNOWN;
            await _navigationService.GoBackAsync();   // here is the problem
        }
    
    Wednesday, August 7, 2019 6:02 PM
  • User396070 posted

    Hi , I have the same problem with my code : I fixed this problem because i found that debugger do not support multiple tasks running on the same time , it need the tasks to be sequenced one after one like this :smile:

    var x=await MyTask1(); var y=await MyTask2(); var z=await MyTask3();

    so when the first task is completed ( x ) then the second will run to get results to ( y) ..etc That's Fixed My Problem .

    Tuesday, August 4, 2020 11:34 AM