Bug 56794 - Visual Studio crashes on startup due to exception thrown in MacDiscoveryService
Summary: Visual Studio crashes on startup due to exception thrown in MacDiscoveryService
Status: RESOLVED ANSWERED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-05-24 10:20 UTC by staircase
Modified: 2017-06-06 20:26 UTC (History)
8 users (show)

Tags:
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 on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description staircase 2017-05-24 10:20:11 UTC
On updating to Xamarin 4.5.0.475 (latest released) attempting to open visual studio projects containing Xamarin apps crashes due to exception. I have attached a debugger and the exception and stack trace are:
System.Net.NetworkInformation.NetworkInformationException: "Invalid access to memory location"
   at System.Net.NetworkInformation.SystemNetworkInterface.GetNetworkInterfaces()
   at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
   at Zeroconf.NetworkInterface.<NetworkRequestAsync>d__0.MoveNext() in C:\projects\zeroconf\Zeroconf.DotNetCore\NetworkInterface.cs:line 29
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Zeroconf.ZeroconfResolver.<ResolveInternal>d__4.MoveNext() in C:\projects\zeroconf\Zeroconf.Shared\ZeroconfResolver.cs:line 75
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Zeroconf.ZeroconfResolver.<ResolveAsync>d__15.MoveNext() in C:\projects\zeroconf\Zeroconf.Shared\ZeroconfResolver.Async.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.VisualStudio.ZeroConf.MacDiscoveryService.<DiscoverHosts>d__23.MoveNext() in C:\d\lanes\4699\70f1268e\source\xamarinvs\src\Core\Xamarin.VisualStudio.ZeroConf\MacDiscoveryService.cs:line 132
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Comment 1 Joaquin Jares 2017-05-24 12:46:15 UTC
Hello! As far as I can tell that is a Windows issue that used to happen in Windows 7.1 and 8.0. You are not running those, right? Further information that would be helpful is your full environment and everything in Help->About in VS, and also, do you have VMs installed and if so, are you turning them on and off when this happens? That could be a root cause that we could investigate.

Thanks,
joj
Comment 2 staircase 2017-05-24 12:52:43 UTC
I am running Windows 7.1. It is definitely an issue with Xamarin in some form as it only started on upgrading to that version of xamarin and removing and reinstalling the version that Visual Studio installs by default causes the problem to disappear.

The VS about details (with Xamarin rolled back) shows:
Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Community

Microsoft Visual Studio Tools for Applications 2015   00322-20000-00000-AA317
Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015   00322-20000-00000-AA317
Microsoft Visual Basic 2015

Visual C# 2015   00322-20000-00000-AA317
Microsoft Visual C# 2015

Visual C++ 2015   00322-20000-00000-AA317
Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package   7.18.00214.2
Application Insights Tools for Visual Studio

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JetBrains ReSharper Ultimate 2017.1.2    Build 108.0.20170428.75743
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Analysis Services   13.0.1701.8
Microsoft SQL Server Analysis Services Designer 
Version 13.0.1701.8

SQL Server Data Tools   14.0.61021.0
Microsoft SQL Server Data Tools

SQL Server Integration Services   
Microsoft SQL Server Integration Services Designer
Version 13.0.1601.5

SQL Server Reporting Services   13.0.1701.8
Microsoft SQL Server Reporting Services Designers 
Version 13.0.1701.8

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

Xamarin   4.2.1.62 (680125b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.2.37 (ce955cc)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.2.1.5 (44931ae)
Visual Studio extension to enable development for Xamarin.iOS.

I can get a copy of this with the failing Xamarin later but can't afford to be without a working copy of visual studio at this exact point in time.
Comment 3 staircase 2017-05-24 13:21:13 UTC
Also I do not have any virtual machines installed although I do have Wireshark install which does change how the networking layer works in some cases which I could believe might change things.
Comment 4 Joaquin Jares 2017-05-24 13:23:55 UTC
We recently changed the way we discover macs to avoid an extra install step that was prone to fail, and that component is what's throwing that exception. Please try installing this: http://support.microsoft.com/kb/2588507. It's supposed to fix an exception in the networking stack in .net.
Comment 5 Joaquin Jares 2017-05-24 13:38:21 UTC
I just re-read my comment and I think I might not have been clear enough: there is a known issue in windows 7.1 with the networking stack, and that's what that kb fixes. It should solve your issue.
Comment 6 staircase 2017-05-24 16:01:01 UTC
Seems to be fixed now. Thanks.
Comment 7 Joaquin Jares 2017-05-24 17:31:01 UTC
Excellent! Thanks.
Comment 8 Aaron Eversole 2017-05-24 21:26:13 UTC
I am having the same issue after I updated to Xamarin 4.5.0.475 this morning. I had to uninstall this update  to get ANY solution to open in Visual Studio 2015. The only difference here is that I am running Windows 10.
Comment 9 Jim Albert 2017-06-05 14:43:07 UTC
I've just opened https://bugzilla.xamarin.com/show_bug.cgi?id=57143, which may be related to this crash as it's also in MacDiscoveryService.  However that crash isn't on startup and is in a different function.