Bug 14232 - Stopping the debugger crashes VS alot
Summary: Stopping the debugger crashes VS alot
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 1.3.x
Hardware: PC Windows
: High critical
Target Milestone: 3.1
Assignee: Joaquin Jares
URL:
Depends on:
Blocks:
 
Reported: 2013-08-25 22:30 UTC by James Clancey
Modified: 2016-05-10 17:02 UTC (History)
19 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:
VERIFIED FIXED

Description James Clancey 2013-08-25 22:30:53 UTC
I am on VS 2012 windows 8. VS crashes regularly when I stop debugging on the device.
Comment 1 James Clancey 2013-08-27 19:08:18 UTC
I noticed this happens almost every single time I am debugging on the device and VS stops at a break point. If I stop debugging VS completely locks up and needs to be force quit.
Comment 2 pierre 2013-08-28 22:54:07 UTC
Same problem for me, VS systematically crashes and restart if I stop the debug session while the program is stopped somewhere in the code (not running).
Comment 3 Szilárd Széll 2013-09-17 07:12:22 UTC
Same here.
Windows 8 Enterprise N
Visual Studio 2012 Update 3
Comment 4 Vinicius Jarina 2013-10-09 20:48:52 UTC
We need a more consistent way to repro this:

Here I am using VS starting and stop debug e few times (device/simulator) without any issue.This is not (Hello World application).[http://screencast.com/t/f0BI5LNWT]

We really want to find out what is happening, but we need some way to repro
Comment 5 Mikkel 2013-11-08 07:18:10 UTC
@Vinicius:

Here is a way to reproduce.

Using:
Windows 7 or 8
Visual Studio 2010 Professional or Premium

1. Create an iPad project
2. Start debugging on iPad Simulator 7.0 on Mac Host
3. Set a breakpoint in code in VS2010
4. Make sure breakpoint is hit
5. When breakpoint is hit and highlighted in yellow, stop the debugging process by pressing SHIFT + F5
6. Observe VS2010 go down in flames

Contact me for further details / documentation.
Comment 6 Mikkel 2013-11-08 07:34:41 UTC
@Vinicius:

This is very weird... I've had this problem constantly for the past week, and now I can't reproduce it like I used to...

I don't know if it helps you, but I've also noticed that sometimes when starting up VS2010 after a crash, in the output window a message is posted every second saying something like "No active project selected", and when I click a project in Solution Explorer it stops outputting that message.

I'll try to reproduce and I'll post any info here...
Comment 7 Alan McGovern 2013-11-14 12:05:09 UTC
I can reproduce this problem. It's a bug in the unregistering of breakpoints in the SDB library where we throw a null reference exception. I need to get Jeff involved the next time I reproduce it locally.
Comment 8 Mikkel 2013-11-15 03:24:50 UTC
The problem occurred Again, and here is the output that kept appearing every 1-2 seconds in the output window:

("Uspecificeret fejl" means "Unspecified error")

[2013-11-13 20:21:19.3] Handling with command: [StatusSdk: CommmandUrl=StatusSdk] (9)
[2013-11-13 20:21:19.6] Attempting to acquire command execution lock, timeout set to 00:10:00
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
System.Runtime.InteropServices.COMException (0x80004005): Uspecificeret fejl (Exception from HRESULT: 0x80004005 (E_FAIL))
   ved EnvDTE._DTE.get_ActiveSolutionProjects()
   ved Mono.VisualStudio.Extension.Utilities.GetCurrentProject(DTE dte)
Mono.VisualStudio.Extension.Utilities Warning: 0 : Failed to retrieve current project.
Comment 10 Alan McGovern 2013-11-15 10:23:00 UTC
Mikkel, These errors are not errors, they are properly handled internally and would not cause a crash. Are you actually experiencing an issue where VS crashes and exits when stopping the debugger or are you just seeing this harmless debug information being logged excessively?
Comment 11 Mikkel 2013-11-15 14:13:51 UTC
Hi Alan,

I never said they were errors, nor did I claim that they were causing the crashes - in fact what I wrote was the complete opposite. My use of the word "error" was simply a translation of the output in VS2010 from Danish "Uspecificeret fejl" to English "Unspecified error".

As I wrote in my previous post, I wanted to inform you that these messages are posted to the output window when I start VS2010 AFTER a fatal crash and, as I also wrote, I don't know if they are helpful to you or not.

Anyway - YES, I'm experiencing crashes in VS2010 on a daily basis, so there are definitely some serious issues regarding debugging and breakpoint handling. It is extremely annoying since VS2010 doesn't remember which files were open before the crash or even more importantly, where you were working in those files - and to make it even worse, the undo history is also lost...!

Best regards
Mikkel

PS: In my opinion an error doesn't necessarily cause a crash - unless it is a fatal error that causes an exception to be thrown, which is not handled appropriately...
Comment 12 Adam 2014-02-27 22:52:44 UTC
I'm experiencing this too - probably every 5 debug sessions, Visual Studio crashes and burns.
It's becoming a real PITA
Comment 13 Adam 2014-02-27 22:56:18 UTC
Error message from Event logs...

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException
Stack:
   at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].FindEntry(System.__Canon)
   at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TryGetValue(System.__Canon, System.__Canon ByRef)
   at Mono.Debugging.Client.DebuggerSession.RemoveBreakEvent(Mono.Debugging.Client.BreakEvent)
   at Mono.Debugging.Client.DebuggerSession+<>c__DisplayClass35.<OnBreakpointRemoved>b__33()
   at Mono.Debugging.Client.DebuggerSession+<>c__DisplayClassb.<Dispatch>b__9(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Comment 14 Adam 2014-02-27 22:59:03 UTC
And another...

The description for Event ID 0 from source Application cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

Error Handler Exception: System.ServiceModel.CommunicationException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: Unrecognized error 109 (0x6d).
   at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
   --- End of inner exception stack trace ---
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ConnectionStream.EndRead(IAsyncResult asyncResult)
   at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
   --- End of inner exception stack trace ---
   at System.Net.Security.NegotiateStream.EndRead(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.StreamConnection.EndRead()
   --- End of inner exception stack trace ---
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
   at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
   at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext) \r\n    at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
   at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
   at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)

the message resource is present but the message is not found in the string/message table
Comment 15 Alan McGovern 2014-02-28 01:01:49 UTC
Adam, the issue you raised in comment 13 has already been resolved and will be part of the next release.

The issue in comment 14 is unusual and doesn't look like it's directly related to the Xamarin extensions. Can you reliably recreate the conditions which trigger it? If so, could you either describe them to us or capture a screencast using software like Jing?
Comment 16 Adam 2014-02-28 01:04:00 UTC
HI Alan,

Both issues appear to occur in unison. I'll capture a screencast and attach it tomorrow.

Thanks
Comment 17 Joaquin Jares 2014-05-20 11:52:24 UTC
The original bug (comment 13) has been fixed. Please file a separate issue for other bugs.
Comment 18 narayanp 2014-06-11 10:45:53 UTC
I have checked this issue with following builds:

All windows
VS 2010
Xamarin VS 3.1.196(5f42a14b3303f88f157a7f26b7ccd300e5da65ef)
X.iOS 7.2.99.420

I have debug the application on iOS devices after setting breakpoint. When breakpoint get stopped, I have click on stop debugging. Application get stopped and VS works successfully. It does not get hang. I have followed same steps 5-6 times.

Hence Closing this issue.
Comment 19 Mikkel 2014-06-11 14:22:39 UTC
Unless this has been fixed in Xamarin  3, the bug is still there - I've had several crashes I the past week, still it is with a shaking hand that I press SHIFT+F5 while the debugger is halted on a breakpoint.

I haven't tried version 3 yet, but in my current version, the problem persists, however it has improved greatly - now it only crashes once to twice a day, before it was almost every hour of the day.

I'm currently on Xamarin.iOS v. 7.2.1.
Comment 20 Adam 2014-06-11 17:35:14 UTC
This issue is not fixed. I for every 10 times I click "stop debugging" in Visual Studio, I get one Visual Studio crash.

I am running all the latest stable components.

Visual Studio 2012 on Windows 8 x64
Xamarin.iOS (VS) 1.10.47 (3d6a125d)
Build Host 7.2.3.39
Comment 21 Adam 2014-06-11 18:08:35 UTC
Here is the stack-trace - can someone please just go do a null reference check before crashing the process??

Thanks.



Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException
Stack:
   at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].FindEntry(System.__Canon)
   at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TryGetValue(System.__Canon, System.__Canon ByRef)
   at Mono.Debugging.Client.DebuggerSession.RemoveBreakEvent(Mono.Debugging.Client.BreakEvent)
   at Mono.Debugging.Client.DebuggerSession+<>c__DisplayClass35.<OnBreakpointRemoved>b__33()
   at Mono.Debugging.Client.DebuggerSession+<>c__DisplayClassb.<Dispatch>b__9(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()



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

Faulting application name: devenv.exe, version: 11.0.61030.0, time stamp: 0x5270a974
Faulting module name: KERNELBASE.dll, version: 6.2.9200.16815, time stamp: 0x52f2c887
Exception code: 0xe0434352
Fault offset: 0x00010f22
Faulting process id: 0x3d50
Faulting application start time: 0x01cf85b754b925c5
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll
Report Id: 687e9b22-f1b4-11e3-beeb-f4b7e2b052d2
Faulting package full name: 
Faulting package-relative application ID:
Comment 22 Alan McGovern 2014-06-12 14:03:29 UTC
Please upgrade to the latest version of the product, the fix for this has been shipping for several releases now.
Comment 23 PJ 2014-06-12 14:07:48 UTC
Adam, everyone - just in case you don't see the update for some reason, the latest version is 3.0.54 and the direct msi link is here: http://download.xamarin.com/XamarinforVisualStudio/Windows/Xamarin.VisualStudio_Setup-3.0.54.0.msi
Comment 24 Adam 2014-06-12 18:10:35 UTC
Thanks PJ.

I should have asked this a while ago - what is the upgrade process for keeping the VS plugin up to date? I have upgraded my Xamarin Studio for Windows - but that obviously didn't upgrade my VS plugin.
I was under the impression that if I kept my XS for OSX up to date, then the Build Host would send the Visual Studio plugin to Visual Studio (I have seen 'out of date' popups in Visual Studio which imply VS was pulling some content from the Build Host).

It's a bit vague, and I'm never sure that all my tools are up to date...

So, to summarise - what do I do to get the latest VS plugin?... and make sure that what I have is indeed the latest?

I would prefer not to have to pull down ~250 MB worth of XS when all I need is the updated plugin...

Thanks
Comment 25 PJ 2014-06-12 18:24:47 UTC
No problem Adam!

To update just the VS extensions, use the msi I linked in comment 23. Going forward, you should use the updater in the VS extensions to update to the newer versions. If you check Tools->Options->Xamarin there will be a place to check for updates manually, and you should get a notification when new updates are available.

There is also another notification that appears to let you know the iOS SDK on your Windows machine differs from the SDK on the Mac, and allows you to transfer the matching SDK to Windows. This does not tell you if there is a new version of Xamarin.iOS available for the Mac, unfortunately.

While we are exploring options to update Xamarin.iOS on the Mac from VS, or at least notify the user when those updates are available, you should also be checking for updates on your Mac (using Xamarin Studio) and updating to the same channel you're using on Windows. This will ensure you are always using a tested combination.

To summarize:

- Use the updater inside of the Xamarin options in VS to keep the VS extensions up to date.
- Use the Xamarin Studio updater on Mac to keep Xamarin.iOS up to date.
Comment 26 Mikkel 2014-06-13 04:35:32 UTC
Alan & PJ:

Does this mean that if we update everything to the latest stable version, both on Mac and VS, that these crashes will be gone??

That would indeed be the greates bugfix ever since I started using Xamarin!

Thanks