0

I have a Xamarin.Forms project and referenced a dll, which I wrote. Don't know since when, but now I can't set a breakpoint in the dll or step into the dll. I'm debugging directly on an Android tablet.

First, I got the message

Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).

Then I changed the debug options and unchecked "Enable Just My Code". Now I 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).

I checked the solutions from this post, but up to now nothing of them worked:

  • pdb files are on the same place, where the dll is
  • "Enable Just My Code" was unchecked
  • everything in Debug mode under Build > Configuration Manager (Xamarin.Forms project as well as library)
  • uncheck of "Require source file exactly match with original Version" and "Step over Properties and Operators"
  • restart of VS
  • clean solutions and rebuild
  • clean of %USERPROFILE%\AppData\Local\Temp as described here
  • checked "Enable native code debugging" in the XF solution project options
  • restarted PC
  • removed app and support libraries from device
  • tried another device incl. emulator

It always worked like this:

  • checked reference to correct dll version (with rebuild)
  • open *.cs file from the dll project
  • set breakpoint or step into dll and have fun

Now it doesn't and I'm runnig out of ideas. I'm using Visual Studio 2019 (v 16.5.4). It does work with project reference, but I don't want to change the settings everytime. Or has this feature (debugging a referenced dll) been removed in VS 2019?

testing
  • 19,681
  • 50
  • 236
  • 417
  • which pdb type have you configured (shared code/app)? it should be [set to "portable"](https://developercommunity.visualstudio.com/solutions/358357/view.html) – magicandre1981 Apr 27 '20 at 14:30
  • I edited the csproj from the Droid project and changed the value for `DebugType` from `full` to `portable`, but still the same problem. Or should I change it elsewhere? – testing Apr 27 '20 at 14:40
  • try "pdbonly" as setting – magicandre1981 Apr 27 '20 at 14:55
  • That also didn't helped. – testing Apr 27 '20 at 14:59
  • @testing I find one article about debugging dll that you can take a look:https://learn.microsoft.com/en-us/visualstudio/debugger/debugging-dll-projects?view=vs-2019 – Cherry Bu - MSFT Apr 28 '20 at 06:54
  • add breakpoint in android app (MainActivity.cs->at LoadApplication(app);) [do 1 step in debug with F11](https://learn.microsoft.com/en-us/visualstudio/debugger/navigating-through-code-with-the-debugger?view=vs-2019#BKMK_Step_into__over__or_out_of_the_code), open [module window](https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-use-the-modules-window?view=vs-2019#use-the-modules-window) inside VS and look if PDB for your dll is loaded – magicandre1981 Apr 28 '20 at 13:54
  • @magicandre1981: yes, symbols are loaded and the location points to the `obj` folder. – testing May 04 '20 at 09:11
  • @CherryBu-MSFT: thanks for link, but I didn't found something which would help me. I don't have a VS 2017 at hand, but either the VS version or the change to .NET Standard could be the reason for this. Before it had worked. – testing May 04 '20 at 09:27

1 Answers1

0

I ran into same error when implementning CrossMediaManager plugin, after seaching a lot, figured out that the instance should be initiated in the app constructor, i.e CrossMediaManager.Current.Init(); in the code sample below:

 public App()
        {
            InitializeComponent();    
            DependencyService.Register<MockDataStore>();
            CrossMediaManager.Current.Init();
            MainPage = new Audio();  
        }
Shaahin
  • 1,195
  • 3
  • 14
  • 22