Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 or GitHub 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.
I face the same Problem as already discussed by martze on your Mailing list (http://mono-for-android.1047100.n5.nabble.com/VS-2010-with-Mono-for-Android-crashes-on-debugging-td5620230.html). Unfortunately I haven't found a solution or a bug report, so I decided to fill out a bug report so that a the problem can be examined and a discovered solution can be documented.
Just a short summary on the problem. Whenever I try to debug an application (independent of emulator or device) which is trowing an exception visual studio crashes.
I already tried to do a repair installation of M4A, some debugging with WinDbg (but since I'm not very familiar with that tool and didn't know what I should looking for without success) and I disabled other VS addins - all without any impact.
So I'm really thankfully for any idea/hint how I can try to track down this issue.
Thanks you any assistance.
I've added some additional logging for 4.1.1 that I hope will help me track this down. I cannot reproduce it, but I know for people who hit this that it happens every time. 4.1.1 should be available shortly.
@Jonathan: Would it be helpful if I install alpha v4.1.1p7 and reproduce the problem?
Yes, if you could please. I believe now you should get a message box with the exception before VS exits.
Unfortunately the behavior hasn't changed with v4.1.1p7 - Visual studio still encounters an error and need to close (without a message box). Any other things I can/should try?
Can you try going to Tools -> Options -> Mono for Android and turning on "Extension Debug Logging"? Then restart VS, hit the error, and see if anything interesting is written to the monodroid.log on your desktop.
Another thing to try is when VS crashes, there is generally a "Debug this application" option which will open a new VS instance. Sometimes it will give a managed stacktrace.
Also, what version of windows are you using and 32/64 bits? And what device or emulator are you trying to debug on?
I'm using Windows 7 Enterprise Service Pack 1 64-bit OS (English version). I use the standard ARM emulator included in the Android SDK Tools Rev. 19 - tried it with images for Android 2.2 (API8) and 4.0 (API14). As a device replacement I just used a VirtualBox x86 Android 2.2 image (http://www.android-x86.org/) - same behavior. Unfortunately I'm unable to test on my real device (Samsung Galaxy I9000) today - but I guess it wouldn't make a difference.
I'm sorry to say that I'm also not getting the "debug this application" screen. I just get the error message - I attach a screenshot - and VS is restarting automatically.
I also attach the monodroid.log of a crash - maybe it will help you to isolate the problem.
Thanks for your efforts and please let me know if I can be of any further assistance.
Created attachment 1788 [details]
Monodroid logging of a crash
Created attachment 1789 [details]
Visual Studio 2010 error message
Please excuse my late reply (for whatever reason I got no email informing me about your reply - maybe the message was recognized as spam).
The new logging is attached - behavior is still the same.
Created attachment 1830 [details]
Monodroid logging of a crash with special debugging version.
When you hit the this, does Visual Studio display the normal "Unhandled Exception" dialog before it crashes? Or does it just crash immediately without a dialog?
Hi Jonathan. Unfortunately I'm not seeing the 'unhandled exception' dialog before VS is crashing. What I have recognized is that VS is trying to show the code containing the exception - but while doing this VS crashes. I attach a sreenshot which hopefully clarifies my statement - a picture paints a thousand words ;-)
Created attachment 1844 [details]
Annotated screenshot of a crash.
I'm sorry - still the same situation after deinstalling the special debugging build and a clean 4.2.1 install.
Even with v4.3.0 pre-release I faced the same behavior. I'll attach the new monodroid.log...
And just to make clear. I only have this problems when debugging a M4A project. If i face unhandled exceptions in normal .Net projects I just see the normal unhandled exception dialog in VS.
Created attachment 1888 [details]
Monodroid logging of a crash with v4.3.0pre.
I was going to report this bug but found that it had already been reported, so instead I'll add to this.
In addition to crashing Visual Studio when an error occurs, it also crashes if you are currently running an application in debug mode and then close the emulator with the X in the corner.
I tried doing this in Eclipse and it doesn't crash the IDE.
This is while using the x86 emulator and Visual Studio 2010.
Created attachment 1928 [details]
Unhandled exception when closning the emulator while debugging (v4.3.0pre)
Yes, thats true - my VS2010 is also crashing when I close the emulator while debugging. I don't know if the two problems are interrelated - maybe you would like to extract a new bug report. I just want to confirm that the problem exists and maybe the attached bugreport is helpful.
Hello support, I've to state that I'm really unhappy - VS/M4A is still crashing and no news from you since two weeks. Since I'm also a developer I'm aware that this might be one of this hard to trace corner-case bugs which consume a lot of your time and might "only" affect a handful of customers. Otherwise we've all bought licenses for M4A and this is really an annoying problem, so maybe you could be so kind and ramp up your efforts on this issue? Of course we'll assist you as effectively as possible. Thanks in advance for your assistance. Best regards, Andreas.
Unfortunately visual studio is still crashing with latest version 4.2.4.
Created attachment 2277 [details]
Monodroid logging of a crash with v4.2.4.
Version 4.2.6, Visual Studio 2010 Ultimate, Windows 7 Enterprise x64 SP1.
Real device or emulator makes no difference. Breakpoints work, but hitting an exception causes VS to crash (exactly the same way as the others listed here).
However I can limp around exceptions by putting a try/catch around the cause of the exception, with a breakpoint inside the catch.
Same problem here.
Version 4.2.7, Visual Studio 2010 Ultimate, Windows 7 Ultimate x64 SP1.
Real device or emulator makes no difference.
No movement on this issue for a very long time, and none of the previously provided solutions seemed to work. Unfortunately, we may need an update to get the ball rolling here, which probably can't be done by 4.8. Moving to 4.8.x.
I also have this problem. Any unhandled exception causes Visual Studio to crash, no unhandled exception dialog is shown. Using version 4.8.0 with Visual Studio 2010 Professional on Windows 7 x64.
This is making debugging extremely difficult and time-consuming. Is there any information I can provide to help get this fixed?
Still no updates on the alpha to fix this issue. This is insanely annoying, Visual Kept crashing when I close the debugger and it's not always when there is an unhandled exception.
This is very time consuming as other state, plus you loose all your Visual Studio state (breakpoints, tab open, etc.) so everytime it crashes you have to find back where you were.
I'm using Visual Studio Pro 2012, version 11.0.60610.01 Update 3, with the latest version of Xamarin and the 4.8.2 (alpha) for Android.
Please fix this issue ASAP!
For others' information, I have been told that there are "not going to be any updates to Android scheduled at the time.", so it's unlikely that this is going away soon.
In case someone does eventually look at it, here is a stack trace from one occurance:
> vsdebug.dll!CDocumentContextWrapper::GetStatementRange() + 0x10 bytes
vsdebug.dll!CTextPos::SetTextPositionFromDocumentContext() + 0xba bytes
vsdebug.dll!CTextPos::SetTextPositionFromDocumentContext() + 0x35 bytes
vsdebug.dll!CDebugger::CreateThreadIpMarkers() + 0x809f5 bytes
vsdebug.dll!CDebugger::RefreshData() + 0x5b bytes
vsdebug.dll!CDebugger::UpdateCurrentStatement() + 0x10ef0 bytes
vsdebug.dll!CDebugger::OnCurrentFrameChange() + 0xb3 bytes
vsdebug.dll!CDebugger::OnCurrentThreadChange() + 0x1c bytes
vsdebug.dll!CDebugger::OnCurrentProgramChange() + 0x1a bytes
vsdebug.dll!CDebugger::OnCurrentProcessChange() + 0x1a bytes
vsdebug.dll!CDebugger::OnEnterBreakState() + 0x10e bytes
vsdebug.dll!CDebugger::OnEnterBreakStateForEvent() + 0x38 bytes
vsdebug.dll!CDebugger::HandleEvent() + 0x54a0 bytes
vsdebug.dll!CDebugger::Event() + 0xaa bytes
vsdebug.dll!sdm::CDebugManager::HandleEvent() + 0xaf bytes
rpcrt4.dll!_Invoke@12() + 0x2a bytes
rpcrt4.dll!_NdrStubCall2@16() + 0x256 bytes
ole32.dll!CStdStubBuffer_Invoke(IRpcStubBuffer *, tagRPCOLEMESSAGE *, IRpcChannelBuffer *) Line 1590 C++
ole32.dll!SyncStubInvoke(tagRPCOLEMESSAGE *, const _GUID &, CIDObject *, void *, IRpcChannelBuffer *, IRpcStubBuffer *, unsigned long *) Line 1187 + 0xf bytes C++
ole32.dll!StubInvoke(tagRPCOLEMESSAGE *, CStdIdentity *, IRpcStubBuffer *, IRpcChannelBuffer *, tagIPIDEntry *, unsigned long *) Line 1396 + 0x1f bytes C++
ole32.dll!CCtxComChnl::ContextInvoke(tagRPCOLEMESSAGE *, IRpcStubBuffer *, tagIPIDEntry *, unsigned long *) Line 1262 + 0x17 bytes C++
ole32.dll!MTAInvoke(tagRPCOLEMESSAGE *, unsigned long, IRpcStubBuffer *, IInternalChannelBuffer *, tagIPIDEntry *, unsigned long *) Line 2105 C++
ole32.dll!STAInvoke(tagRPCOLEMESSAGE *, unsigned long, IRpcStubBuffer *, IInternalChannelBuffer *, void *, tagIPIDEntry *, unsigned long *) Line 1924 C++
ole32.dll!AppInvoke(CMessageCall *, CRpcChannelBuffer *, IRpcStubBuffer *, void *, void *, tagIPIDEntry *, LocalThis *) Line 1086 C++
ole32.dll!ComInvokeWithLockAndIPID(CMessageCall *, tagIPIDEntry *) Line 1724 + 0x17 bytes C++
ole32.dll!ComInvoke(CMessageCall *) Line 1469 C++
ole32.dll!ThreadDispatch(void *) Line 298 + 0x6 bytes C++
ole32.dll!ThreadWndProc(HWND__ *, unsigned int, unsigned int, long) Line 654 C++
user32.dll!_InternalCallWinProc@20() + 0x23 bytes
user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes
user32.dll!_DispatchMessageWorker@8() + 0xed bytes
user32.dll!_DispatchMessageW@4() + 0xf bytes
msenv.dll!ProcessMessage() + 0x4d bytes
msenv.dll!CMsoCMHandler::EnvironmentMsgLoop() + 0x87 bytes
msenv.dll!CMsoCMHandler::FPushMessageLoop() + 0x79 bytes
msenv.dll!SCM::FPushMessageLoop() + 0x8c bytes
msenv.dll!SCM_MsoCompMgr::FPushMessageLoop() + 0x2a bytes
msenv.dll!CMsoComponent::PushMsgLoop() + 0x28 bytes
msenv.dll!VStudioMainLogged() + 0x22a bytes
msenv.dll!_VStudioMain() + 0x78 bytes
devenv.exe!util_CallVsMain() + 0xdb bytes
devenv.exe!CDevEnvAppId::Run() + 0x693 bytes
devenv.exe!_WinMain@16() + 0x9c bytes
devenv.exe!operator new() + 0xb31c bytes
kernel32.dll!@BaseThreadInitThunk@12() + 0x12 bytes
ntdll.dll!___RtlUserThreadStart@8() + 0x27 bytes
ntdll.dll!__RtlUserThreadStart@8() + 0x1b bytes
This bug was targeted for a past milestone, moving to the next active non-hotfix milestone.
I've been trying to replicate this issue in VS2010 and VS2012 with Xamarin.Android 4.10.1
Case 1) Shutting down the emulator,whilst halted on a breakpoint.
Does not crash the IDE here, it just waits until you try to do something like step or run. At which point execution stops, and you return to the IDE. I get an device connection lost error dialog.
Case 2) IDE crashes when unhandled exception is thrown
I tried to replicate this just by putting a simple
throw new Exeption();
in the Activity OnCreate method. The IDE did not crash, but I did get a VS unhandled exception dialog with Break/Continue buttons as I would expect.
If possible can you provide a small app which replicates the issue?
I can reproduce the second case 100% of the time purely by throwing an unhandled exception:
> using System;
> using Android.App;
> using Android.OS;
> namespace XamarinCrash
> [Activity(Label = "XamarinCrash", MainLauncher = true, Icon = "@drawable/icon")]
> public class Activity1 : Activity
> protected override void OnCreate(Bundle bundle)
> throw new Exception();
If I start with debugging with this program, Visual Studio crashes as soon as the program begins executing.
Clearly this bug is nothing to do with the application being debugged, but is related to the configuration of the development environment and the host and/or guest OS.
The same issue occurs on a physical device (Android 2.3 and 4.2), and the Google emulator, and Genymotion.
I can reproduce it reliably on both my workstations, one of them both before and after a complete OS reinstall. Both use VS2010 with SP1 and the latest release of Xamarin.Android.
Also, notice that the observation (and demonstrating screenshot) provided by Andreas appears to be consistent with the stack trace I collected and posted just above. Visual Studio seems to be trying to show the location in the code where the exception has occurred, but fails at 'vsdebug.dll!CDocumentContextWrapper::GetStatementRange()' whilst trying to do this.
I don't know anything about the internals of integrating with VS, but whatever component is responsible for mapping locations in an executing program to locations in source code seems like a good place to start looking.
Sorry, I'm no longer able to reproduce this issue - since I reported this problem more than one and a half year ago, we've updated in the meanwhile to VS2013 Xamarin.Android 4.10.10703 (and at least with this configuration I haven't encountered problems with unhandled exceptions).
Is anyone still able to reproduce this? I've been testing on the latest versions and unhanded exceptions do not crash the IDE.