Bug 42859 - Improve error message related to Visual Studio Emulator and Skylake processers
Summary: Improve error message related to Visual Studio Emulator and Skylake processers
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: dean.ellis
URL:
: 40544 42724 ()
Depends on:
Blocks:
 
Reported: 2016-07-27 22:00 UTC by Cody Beyer (MSFT)
Modified: 2017-06-23 17:36 UTC (History)
10 users (show)

Tags: bb
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 42859 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Cody Beyer (MSFT) 2016-07-27 22:00:00 UTC
# Description

There is currently an issue with Hyper-V and Skylake processors where the mono debugger is unable to attach to the emulator using default processor settings.

This can be fixed by applying the steps referenced below [1], however when a user attempts to deploy to Visual Studio Emulator, a generic error is thrown along the lines of:

> AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/TestApp.TestApp-1/libaot-mscorlib.dll.so" not found

The error could lead to confusion, as searching the error does not lead to the fix. It could be improved by either printing an error message pointing to this fix, or detecting if the processor is impacted by this bug and notifying the user

[1]
https://msdn.microsoft.com/en-us/library/mt228282.aspx#Anchor_10

# System Profile 

System Model	Surface Book
System Type	x64-based PC
System SKU	Surface_Book
Processor	Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz, 2496 Mhz, 2 Core(s), 4 Logical Processor(s)
BIOS Version/Date	Microsoft Corporation 89.1203.768, 5/19/2016
Comment 1 Cody Beyer (MSFT) 2016-07-27 22:00:18 UTC
*** Bug 42724 has been marked as a duplicate of this bug. ***
Comment 2 Jon Douglas [MSFT] 2016-07-28 15:17:32 UTC
Adding the original blog post for visibility:

https://blogs.msdn.microsoft.com/cesardelatorre/2016/02/06/solving-issue-with-vs-android-emulator-xamarin-apps-and-intel-skylake-processor-i-e-when-using-a-microsoft-surface-book-i7-surface-pro-4-etc/

I worked with Cesar awhile back on this issue and after talking to the MS VS Emulator team, we found out this was the case and documented it.
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-07-28 15:21:53 UTC
I believe you would find that the AOT warning you mentioned will appear on all emulators and devices:

> AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/TestApp.TestApp-1/libaot-mscorlib.dll.so" not found

That `.so` file is _expected_ to be absent when building apps without AOT compilation.  If the problem is that the app is launching successfully but the debugger is not attaching, then I would not expect _any_ related error messages in the `adb logcat`.  There might be some related messages in the IDE logs for Xamarin or the other output windows in Visual Studio.

In short, the AOT error is very likely a "false clue" about the underlying problem and can be ignored.
Comment 4 Jon Douglas [MSFT] 2016-07-28 15:36:05 UTC
IIRC the runtime checks for the AOT compiled assembly and does not find it and falls back to the JIT compiler instead. So the warning here is perfectly normal.

If anything there would be an error message regarding the debugger not attaching/connecting.

EX:

01-31 12:49:09.246 W/monodroid-debug( 1100): Trying to initialize the
debugger with options:
--debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8887
,server=y,embedding=1
01-31 12:49:09.366 W/monodroid-debug( 1100): Accepted stdout connection: 43
Could not connect to the debugger.

These can be found in the .svclog of the IDE:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2016-01-30T19:19:30.8055069Z" /><Source Name="Xamarin.VisualStudio.IOS.XamarinIOSPackage" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="devenv" ProcessID="504" ThreadID="245" /><Channel /><Computer>CESARDLBOOKVHD</Computer></System><ApplicationData>MonoAndroidDebuggerSession
Mono.Debugging.Soft.ConnectionException: Could not connect to the debugger. ---&gt; Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.

Server stack trace: 
   at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
   at Mono.Debugger.Soft.Connection.VM_GetVersion()
   at Mono.Debugger.Soft.Connection.Connect()
   at Mono.Debugger.Soft.VirtualMachine.connect()
   at Mono.Debugger.Soft.VirtualMachineManager.Connect(Connection transport, StreamReader standardOutput, StreamReader standardError)
   at Mono.Debugger.Soft.VirtualMachineManager.ConnectInternal(Socket dbg_sock, Socket con_sock, IPEndPoint dbg_ep, IPEndPoint con_ep)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]&amp; outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData&amp; msgData)
   at Mono.Debugger.Soft.VirtualMachineManager.ConnectCallback.EndInvoke(IAsyncResult result)
   at Mono.Debugger.Soft.VirtualMachineManager.EndConnect(IAsyncResult asyncResult)
   at Mono.Debugging.Soft.SoftDebuggerSession.&lt;&gt;c__DisplayClass52_0.&lt;StartConnecting&gt;b__0(IAsyncResult ar)
   --- End of inner exception stack trace ---</ApplicationData></E2ETraceEvent>

======================================

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2016-01-30T19:19:31.8454246Z" /><Source Name="Xamarin.VisualStudio.ProgressReport" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="devenv" ProcessID="504" ThreadID="243" /><Channel /><Computer>CESARDLBOOKVHD</Computer></System><ApplicationData>Mono.Debugging.Soft.ConnectionException: Could not connect to the debugger. ---&gt; Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.

Server stack trace: 
   at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
   at Mono.Debugger.Soft.Connection.VM_GetVersion()
   at Mono.Debugger.Soft.Connection.Connect()
   at Mono.Debugger.Soft.VirtualMachine.connect()
   at Mono.Debugger.Soft.VirtualMachineManager.Connect(Connection transport, StreamReader standardOutput, StreamReader standardError)
   at Mono.Debugger.Soft.VirtualMachineManager.ConnectInternal(Socket dbg_sock, Socket con_sock, IPEndPoint dbg_ep, IPEndPoint con_ep)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]&amp; outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData&amp; msgData)
   at Mono.Debugger.Soft.VirtualMachineManager.ConnectCallback.EndInvoke(IAsyncResult result)
   at Mono.Debugger.Soft.VirtualMachineManager.EndConnect(IAsyncResult asyncResult)
   at Mono.Debugging.Soft.SoftDebuggerSession.&lt;&gt;c__DisplayClass52_0.&lt;StartConnecting&gt;b__0(IAsyncResult ar)
   --- End of inner exception stack trace ---</ApplicationData></E2ETraceEvent>
Comment 5 Jon Douglas [MSFT] 2016-07-28 15:41:25 UTC
This is more accurate of the Xamarin.VisualStudio.Android.XamarinAndroidPackage. The previous seemed to be caught in the iOS one instead:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2016-01-30T23:28:27.3164915Z" /><Source Name="Xamarin.VisualStudio.Android.XamarinAndroidPackage" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="devenv" ProcessID="11436" ThreadID="7" /><Channel /><Computer>CESARDLBOOKVHD</Computer></System><ApplicationData>MonoAndroidDebuggerSession
Mono.Debugging.Soft.ConnectionException: Could not connect to the debugger. ---&gt; Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.

Server stack trace: 
   at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
   at Mono.Debugger.Soft.Connection.VM_GetVersion()
   at Mono.Debugger.Soft.Connection.Connect()
   at Mono.Debugger.Soft.VirtualMachine.connect()
   at Mono.Debugger.Soft.VirtualMachineManager.Connect(Connection transport, StreamReader standardOutput, StreamReader standardError)
   at Mono.Debugger.Soft.VirtualMachineManager.ConnectInternal(Socket dbg_sock, Socket con_sock, IPEndPoint dbg_ep, IPEndPoint con_ep)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]&amp; outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData&amp; msgData)
   at Mono.Debugger.Soft.VirtualMachineManager.ConnectCallback.EndInvoke(IAsyncResult result)
   at Mono.Debugger.Soft.VirtualMachineManager.EndConnect(IAsyncResult asyncResult)
   at Mono.Debugging.Soft.SoftDebuggerSession.&lt;&gt;c__DisplayClass52_0.&lt;StartConnecting&gt;b__0(IAsyncResult ar)
   --- End of inner exception stack trace ---</ApplicationData></E2ETraceEvent>
Comment 6 pmaske 2016-08-17 19:40:14 UTC
I am still facing the problem. The workaround suggested above did not work for me. The emulator shows up running but the app never deploys. This is so very annoying. It have been stuck on this for past two days with no luck. Are there any other suggestion in resolving this.

I am running on Surface Pro with i7
VS2015 + update 3
Xamarin 4.1.2.18
VS emulator for android 1.1.622.2
I have already tried 
- clearing the state and changing hyper-v> setting>processor...option
- The registry key seems to be pointing to correct Android SDK location.
Comment 7 Juan Marcelo Tondato 2016-08-26 14:10:06 UTC
*** Bug 40544 has been marked as a duplicate of this bug. ***
Comment 8 Joaquin Jares 2016-12-22 19:17:26 UTC
This issue is in the Android deploy targets. Moving to Android.