Bug 27662 - Crash due to AccessViolationException during Xamarin.VisualStudio.Diagnostics.RaygunTraceExtensions()
Summary: Crash due to AccessViolationException during Xamarin.VisualStudio.Diagnostics...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 3.9
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Brendan Zagaeski (Xamarin Team, assistant)
Depends on:
Reported: 2015-03-04 14:24 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-12-23 12:56 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

Log files (290.97 KB, application/zip)
2015-03-04 14:24 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 Brendan Zagaeski (Xamarin Team, assistant) 2015-03-04 14:24:34 UTC
Created attachment 10157 [details]
Log files

Crash due to AccessViolationException during Xamarin.VisualStudio.Diagnostics.RaygunTraceExtensions() when quitting Visual Studio.

## Steps followed to produce

I was working on an MvvmCross app that included Android, iOS, and Windows Phone projects. When I quit Visual Studio, Windows informed me that the application had crashed.

As evident from the log files, I had fairly recently stopped debugging the iOS app before I tried to quit Visual Studio.

## Results

Full logs attached.

### Last error in the devenv*.svclog file

> Background task error
> System.InvalidOperationException: The source completed without providing data to receive.
>    at System.Threading.Tasks.Dataflow.Internal.Common.InitializeStackTrace(Exception exception)
> --- 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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
>    at Microsoft.VisualStudio.ProjectSystem.Utilities.Designers.ProjectDataSources.<>c__DisplayClass22.<<SyncLinkTo>b__1b>d__29.MoveNext()

### Crash report from Windows Event Viewer

(Time of event: 1:58:50 PM)

> Application: devenv.exe
> Framework Version: v4.0.30319
> Description: The process was terminated due to an unhandled exception.
> Exception Info: System.AccessViolationException
> Stack:
>    at System.Management.IEnumWbemClassObject.Next_(Int32, UInt32, System.Management.IWbemClassObject_DoNotMarshal[], UInt32 ByRef)
>    at System.Management.ManagementObjectCollection+ManagementObjectEnumerator.MoveNext()
>    at Mindscape.Raygun4Net.Messages.RaygunEnvironmentMessage.GetCpu()
>    at Mindscape.Raygun4Net.Messages.RaygunEnvironmentMessage..ctor()
>    at Mindscape.Raygun4Net.RaygunMessageBuilder.SetEnvironmentDetails()
>    at Mindscape.Raygun4Net.RaygunClient.BuildMessage(System.Exception)
>    at Mindscape.Raygun4Net.RaygunClient.Send(System.Exception, System.Collections.Generic.IList`1<System.String>, System.Collections.IDictionary, System.String)
>    at Xamarin.VisualStudio.Diagnostics.RaygunTraceExtensions+<>c__DisplayClass6.<RaygunReportException>b__2(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()

## Version info

### Windows 8.1 64-bit, in VMWare Fusion 6.0.5 (2209127)

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.9.344.0 (e23ab72)
Xamarin.Android (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS (862702c6b8aa14a373e25f83ac45918556af41a2)

### OS X 10.9.5, MacBook Air

Version: (Business Edition)
Hash: 9905782
Build date: 2015-02-26 11:05:07-0500

Xcode 6.1.1 (6611), Build 6A2008a
Comment 2 Abhishek 2015-08-25 07:01:06 UTC
I have tried this issue but unable to reproduce the reported behavior at my end.

1. Download the sample application.
2. Run the application on IOS Device/Simulator.
3. Application Deploy successfully on Simulator/Device.
4. Stop the debugging and tried to quit the VS . But I am unable to reproduce the issue.

Could you please let me know what steps I am missing to reproduce this issue at my end?

Screencast: http://www.screencast.com/t/8n7HRZ9UspKL

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00081

Xamarin   3.11.893.0 (dd3b114)
Xamarin.Android (965922617b643927fd4a01adae68730b63a01ecb)
Xamarin.Forms Intellisense   1.0
Xamarin.iOS (67572797c1794b8219673503e84709d6a775628a)
Xamarin.iOS Unified Migration   1.0
Xamarin.TestCloud.Integration   1.0
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-27 14:52:26 UTC
If I recall correctly, I think I only hit this issue "by luck" one time, so I'm not sure how easy it will be to reproduce, even when using the old version (3.9.344) that I know had the problem.

Even so, I'll tentatively set the bug back to "confirmed" for now in the hopes that either (a) this Raygun code has already been completely removed from the code base, or (b) the stack trace might be enough of a clue that the engineers will be able to see where problem is coming from (for example, maybe an upstream bug in Raygun4Net).
Comment 6 mag@xamarin.com 2016-12-23 12:56:56 UTC
Marking this issue as fixed since we are not using Raygun anymore for Insights