Bug 27445 - Visual Studio Crash
Summary: Visual Studio Crash
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 3.9
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-02-25 19:58 UTC by rsahu
Modified: 2016-12-22 21:53 UTC (History)
5 users (show)

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:

Description rsahu 2015-02-25 19:58:31 UTC
I'm getting serious issues with using Xamarin Android in the last few days. Anytime I compile a solution with a few files open, visual studio crashes.

This happens with both Visual Studio 2013 and 2012. Using Xamarin

Following error is logged in Event Viewer:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at EnvDTE.ProjectItem.get_ContainingProject()
   at Xamarin.VisualStudio.ProjectInterfaceConverters.GetSelectedProject(System.IServiceProvider)
   at Xamarin.VisualStudio.Android.DeploymentTasks.IsForceDeployment(Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject)
   at Xamarin.VisualStudio.Android.MonoAndroidDeploySession.BuildAndSignPackage(System.Threading.CancellationToken)
   at Xamarin.VisualStudio.Android.MonoAndroidDeploySession.DeployApplication(Mono.AndroidTools.AndroidDevice, System.Threading.CancellationToken)
   at Xamarin.VisualStudio.Android.MonoAndroidDeploySession.OnDeploy()
   at Xamarin.VisualStudio.Android.MonoAndroidDeploySession.<Xamarin.VisualStudio.Android.IMonoAndroidProcessSession.Start>b__4()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(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.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Comment 1 Ian Ceicys 2015-02-26 09:50:03 UTC
Hi Rsahu,
I am investigating your issue. Can you please let me know the following:
What update are you running on Visual Studio 2012/2013. Please ensure you are running Update 4.
What version of Android is your solution targeting?
Have you done a clean before you build?
Comment 2 rsahu 2015-02-26 17:19:39 UTC
Thanks for looking into this. I'm on VS2013 Update 4. This issue seems to have started happening when I got the Xamarin update 3.9.302 (although I'm not 100% if that was indeed the cause). I've tried downgrading all the way to 3.8.150 and still get the same problem.
It seems to happen immediately after it zipaligns the APK.
It works fine if I close all the documents in the visual studio and deploy.

Is there a way to completely remove all the Xamarin components and reinstall? Using Add/Remove programs doesn't seem to remove all the settings.
Comment 3 rsahu 2015-02-26 17:53:54 UTC
Forgot to add, the solution is built for Android 3.2 SDK. android:minSdkVersion="8" android:targetSdkVersion="14".

I've tried clean multiple times. The same solution builds fine on another machine with very similar setup running Xamarin Android 3.9.289.
Comment 4 rsahu 2015-03-02 20:52:27 UTC
Hi Ian Ceicys,
Any update on this?
Comment 5 Enzo Heredia 2015-12-09 18:55:34 UTC
Hi rsahu,
is this still reproducible for you?
Comment 6 Jose Gallardo 2016-12-22 21:53:48 UTC
As we've introduced several improvements around the Android build system, I'll mark the bug as resolved fixed.
Please feel free to reopen it if you can still reproduce the issue with current bits.