dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.04k forks source link

FailFast attempting to show light bulb in integration tests #35123

Open sharwell opened 5 years ago

sharwell commented 5 years ago

https://dev.azure.com/dnceng/public/_build/results?buildId=160903

Event Time (UTC): 4/18/2019 9:43:58 PM
Event ID: 1025
Data: Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.ArgumentException: The supplied SnapshotPoint is on an incorrect snapshot.
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception)
   at Microsoft.VisualStudio.IntegrationTest.Setup.TestExtensionErrorHandler.HandleError(System.Object, System.Exception)
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.HandleException(System.Object, System.Exception)
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.ValidateBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint)
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.Microsoft.VisualStudio.Text.Editor.IWpfTextView.GetTextViewLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint)
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.GetTextViewLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbBroker.CreateSession(Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet, Microsoft.VisualStudio.Text.Editor.ITextView, Microsoft.VisualStudio.Text.ITrackingPoint, Microsoft.VisualStudio.Text.ITrackingSpan, System.Collections.Generic.Dictionary`2<Microsoft.VisualStudio.Text.SnapshotSpan,System.Collections.Generic.IEnumerable`1<Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionsSource>>, Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet, Boolean, Boolean)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbBroker.CreateSession(Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet, Microsoft.VisualStudio.Text.Editor.ITextView, Microsoft.VisualStudio.Text.ITrackingPoint, Microsoft.VisualStudio.Text.ITrackingSpan, Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet, Boolean, Boolean)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbBroker.CreateSession(Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet, Microsoft.VisualStudio.Text.Editor.ITextView, Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbController.CreateOrResetSession(Microsoft.VisualStudio.Language.Intellisense.ISuggestedActionCategorySet)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbController+<RefreshSessionAsync>d__26.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(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.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
   at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation+<>c.<.cctor>b__8_0(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(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.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents.OnReplace(Microsoft.VisualStudio.TextManager.Interop.ChangeInput[])
   at Microsoft.VisualStudio.Editor.Implementation.TextDocData+<>c__DisplayClass180_1.<RaiseReplaceEvent>b__0()
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(System.Object, System.Action)
   at Microsoft.VisualStudio.Editor.Implementation.TextDocData.RaiseReplaceEvent(ReplaceEventHandler, Microsoft.VisualStudio.TextManager.Interop.ChangeInput[])
   at Microsoft.VisualStudio.Editor.Implementation.TextDocData.OnTextBufferChangedHighPriority(System.Object, Microsoft.VisualStudio.Text.TextContentChangedEventArgs)
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Object, System.EventHandler`1<System.__Canon>, System.__Canon)
   at Microsoft.VisualStudio.Text.Implementation.BaseBuffer.RawRaiseEvent(Microsoft.VisualStudio.Text.TextContentChangedEventArgs, Boolean)
   at Microsoft.VisualStudio.Text.Implementation.BaseBuffer+TextContentChangedEventRaiser.RaiseEvent(Microsoft.VisualStudio.Text.Implementation.BaseBuffer, Boolean)
   at Microsoft.VisualStudio.Text.Implementation.BufferGroup.RaiseEvents()
   at Microsoft.VisualStudio.Text.Implementation.BufferGroup.FinishEdit()
   at Microsoft.VisualStudio.Text.Implementation.BaseBuffer+TextBufferEdit.Apply()
   at Microsoft.VisualStudio.Text.Implementation.BaseBuffer.Replace(Microsoft.VisualStudio.Text.Span, System.String)
   at Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess.Editor_InProc+<>c__DisplayClass16_0.<ReplaceText>b__0(Microsoft.VisualStudio.Text.Editor.IWpfTextView)
   at Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess.TextViewWindow_InProc+<>c__DisplayClass13_0.<GetExecuteOnActionViewCallback>b__0(System.Threading.CancellationToken)
   at Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess.InProcComponent+<>c__DisplayClass6_0.<InvokeOnUIThread>b__0()
   at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(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.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
sharwell commented 5 years ago

@olegtk the exception appears to be an editor bug. I'm going to exclude it in our FailFast handling but it should really be fixed.

jasonmalinowski commented 1 year ago

@sharwell I see this workaround is still present; any idea if we should remove it now?

sharwell commented 1 year ago

I guess just try to remove it and see if it fails again?