Xamarin.Forms Problem “Could Not Connect To Debugger” Solution

There are some issues traced in the Xamarin 15.2 release. One of the major issued faced by developers is a debugging error.

  • The app is deployed
  • The app starts on the emulator
  • It immediately stops
  • You get one or more of the following messages in your output window:

Xamarin

This issue is faced by many of the developers who are new in this field. This issue was first faced in Visual Studio 2015. This issue is resolved by ReSharper but it is costly. So I will give you the simple solution for that issue.

MSCORLIB.DLL Error Information

Microsoft Core Library is at the heart of everything. There is a more "massaged" explanation you may prefer:

"When Microsoft first started working on the .NET Framework, MSCorLib.dll was an acronym for Microsoft Common Object Runtime Library. Once ECMA started to standardize the CLR and parts of the FCL, MSCorLib.dll officially became the acronym for Multilanguage Standard Common Object Runtime Library."

The .NET 2.0 assembly will reference and use the 2.0 mscorlib. The .NET 1.1 assembly will reference the 1.1 mscorlib but will use the 2.0 mscorlib at runtime. (due to hard-coded version redirects in the runtime itself)

Is it possible to force a different runtime to be loaded by the application by making a configuration setting in your app / web.config? You won’t be able to choose the CLR version by settings in the Configuration File – at that point, a CLR will already be running, and there can only be one per process. Immediately after the CLR is chosen the mscorlib appropriate for that CLR is loaded.

Solution

As we know this happens when we create a new project so the solution is given below,

Go to the properties of the Android project, hit tab “Android options”, and unselect “Use Fast Deployment”

Xamarin

Xamarin

This will solve the issue of “libaot-mscorlib.dll”.

Now do the following steps:

  • Start the Hyper-V manager
  • Select the emulator you are trying to use
  • Right-click, hit settings

    Xamarin

  • Click processor
  • Click Compatibility
  • Click the checkbox “Migrate to a physical computer with a different processor version”

Xamarin

Now, debug your application and it will work fine.

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now