Bug 57143 - Visual Studio Crashes when connecting to VPN in MacDiscoveryService DiscoverHosts at System.Net.Sockets.Socket.set_ExclusiveAddressUse with an InvalidOperationException
Summary: Visual Studio Crashes when connecting to VPN in MacDiscoveryService DiscoverH...
Status: RESOLVED FIXED
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-06-05 14:41 UTC by Jim Albert
Modified: 2017-06-07 17:42 UTC (History)
6 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 FIXED

Description Jim Albert 2017-06-05 14:41:09 UTC
Overview:

Visual Studio 2017 crashes a short time after connecting to VPN, after having been started while disconnected from VPN.

According to the Visual Studio crash dump, it's crashing in Xamarin.VisualStudio.ZeroConf.MacDiscoveryService DiscoverHosts, the stack trace is below.  I'm at the latest stable release of Visual Studio 2017 15.2 26430.12, using Xamarin 4.5.0.476.

Note that there aren't any iOS/Mac projects in the solution, however there are discoverable iOS/Mac devices on the network while *not* connected to VPN.

BUGCHECK_STR:  CLR_EXCEPTION_System.InvalidOperationException_NOSOS

STACK_TEXT:  
11c7e334 61672695 System_ni!System.Net.Sockets.Socket.set_ExclusiveAddressUse+0x21f3fd
11c7e340 4dc28665 UNKNOWN!Zeroconf.NetworkInterface+_NetworkRequestAsync_d__1.MoveNext+0x255
11c7e270 624183f7 mscorlib_ni!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw+0x1b
11c7e278 4dc28ab2 UNKNOWN!Zeroconf.NetworkInterface+_NetworkRequestAsync_d__1.MoveNext+0x6a2
11c7df54 61bbffb1 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess+0x5d
11c7df64 61bbca43 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification+0x3b
11c7df70 4dbbfe7b UNKNOWN!Zeroconf.NetworkInterface+_NetworkRequestAsync_d__0.MoveNext+0x173
11c7dc74 61bbffb1 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess+0x5d
11c7dc84 61bbca43 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification+0x3b
11c7dc90 4dbbf1ef UNKNOWN!Zeroconf.ZeroconfResolver+_ResolveInternal_d__4.MoveNext+0x317
11c7d97c 61bbffb1 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess+0x5d
11c7d98c 61bbca43 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification+0x3b
11c7d998 4dbbe428 UNKNOWN!Zeroconf.ZeroconfResolver+_ResolveAsync_d__15.MoveNext+0x198
11c7d6c0 61bbffb1 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess+0x5d
11c7d6d0 61bbca43 mscorlib_ni!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification+0x3b
11c7d6dc 4dbbdae4 UNKNOWN!Xamarin.VisualStudio.ZeroConf.MacDiscoveryService+_DiscoverHosts_d__23.MoveNext+0xbc
442ce878 62472425 mscorlib_ni!System.Runtime.CompilerServices.AsyncMethodBuilderCore+__c._ThrowAsync_b__6_1+0x35
442ce880 61bcacb2 mscorlib_ni!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context+0x42
442ce888 61c11512 mscorlib_ni!System.Threading.ExecutionContext.RunInternal+0xc2
442ce8f4 61c11446 mscorlib_ni!System.Threading.ExecutionContext.Run+0x16
442ce908 61bcbbb0 mscorlib_ni!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem+0x60
442ce91c 61bcb2d3 mscorlib_ni!System.Threading.ThreadPoolWorkQueue.Dispatch+0x153
442ce96c 61bcb17a mscorlib_ni!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback+0xa


Steps to Reproduce:

1) Disconnect from VPN.

2) Open a solution.  This doesn't seem to occur until after the solution has been loaded.

3) Connect to VPN.

4) Wait a short while (~5 sec).  A dialog will appear with the message "Microsoft Visual Studio is Restarting..."


Actual Results:

Visual Studio crashes.


Expected Results:

Visual Studio should not crash when connecting to VPN.


Build Date & Hardware:

Visual Studio 2017 15.2 26430.12, using Xamarin 4.5.0.476, on Windows 10 x64 1607 14393.1198.


Additional Builds and Platforms:

This didn't happen in the original Visual Studio 2017 release.  It seems to have started with the current 15.2 release, but it may have been earlier as I use VPN intermittently.

This may be related to bug https://bugzilla.xamarin.com/show_bug.cgi?id=56794, however that crash is on startup and in a different function.
Comment 1 sergioko 2017-06-06 16:55:42 UTC
I have a similar issue. VisualStudio 2015 Update 3 (version 14.0.25431.01) crashes. My OS Windows 10.0.14393.1198 has this two events logged in Application Logs:

--------------------------
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
   at System.Net.Sockets.Socket.set_ExclusiveAddressUse(Boolean)
   at Zeroconf.NetworkInterface+<NetworkRequestAsync>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Zeroconf.NetworkInterface+<NetworkRequestAsync>d__1.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Zeroconf.NetworkInterface+<NetworkRequestAsync>d__0.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Zeroconf.ZeroconfResolver+<ResolveInternal>d__4.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Zeroconf.ZeroconfResolver+<ResolveAsync>d__15.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Xamarin.VisualStudio.ZeroConf.MacDiscoveryService+<DiscoverHosts>d__23.MoveNext()


and then:
--------------------------
Faulting application name: devenv.exe, version: 14.0.25420.1, time stamp: 0x57685d85
Faulting module name: KERNELBASE.dll, version: 10.0.14393.1198, time stamp: 0x5902845a
Exception code: 0xe0434352
Fault offset: 0x000da9f2
Faulting process id: 0x1b34
Faulting application start time: 0x01d2dee0daa7b7e4
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll


Hope this helps.
Comment 2 sergioko 2017-06-06 22:30:46 UTC
After downgrading Xamarin from 4.5.0.476 back to 4.5.0.443 problem resolved, no more crashes.
Comment 3 Jim Albert 2017-06-07 15:22:09 UTC
Can somebody from the Xamarin team triage this as soon as possible please?

I need to connect to VPN before I can commit to source control, so this bug is causing severe problems for me.

I can't backdate Visual Studio 2017 as a work around because of the previous bug where the dll files were being locked.
Comment 4 Joaquin Jares 2017-06-07 17:42:36 UTC
Fixed. The fix will be available in the next release (before the end of the week).