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
18.71k stars 3.98k forks source link

VS Intellisense for csx files crashes when adding an event handler #13887

Open adamralph opened 7 years ago

adamralph commented 7 years ago

Version Used:

Visual Studio Enterprise 2015 Update 3

Steps to Reproduce:

  1. Open a csx file.
  2. Type System.AppDomain.CurrentDomain.AssemblyLoad +=.

Expected Behavior:

Intellisense does not crash.

Actual Behavior:

Intellisense does crash:

image

From ActivityLog.xml:

  <entry>
    <record>580</record>
    <time>2016/09/18 12:46:46.206</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.&#x000D;&#x000A;Parameter name: span&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Implementation.TrackingSpan..ctor(ITextVersion version, Span span, SpanTrackingMode trackingMode)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Implementation.TextVersion.CreateTrackingSpan(Span span, SpanTrackingMode trackingMode, TrackingFidelityMode trackingFidelity)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Implementation.BaseSnapshot.CreateTrackingSpan(Span span, SpanTrackingMode trackingMode)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CSharp.EventHookup.EventHookupSessionManager.EventHookupSession..ctor(EventHookupSessionManager eventHookupSessionManager, EventHookupCommandHandler commandHandler, ITextView textView, ITextBuffer subjectBuffer, IAsynchronousOperationListener asyncListener, Mutex testSessionHookupMutex)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CSharp.EventHookup.EventHookupSessionManager.BeginSession(EventHookupCommandHandler eventHookupCommandHandler, ITextView textView, ITextBuffer subjectBuffer, AggregateAsynchronousOperationListener asyncListener, Mutex testSessionHookupMutex)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CSharp.EventHookup.EventHookupCommandHandler.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.&lt;&gt;c__DisplayClass6_1`1.&lt;ExecuteHandlers&gt;b__1()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.DocumentationComments.AbstractDocumentationCommentCommandHandler`2.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.&lt;&gt;c__DisplayClass6_1`1.&lt;ExecuteHandlers&gt;b__1()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Controller.Microsoft.CodeAnalysis.Editor.ICommandHandler&lt;Microsoft.CodeAnalysis.Editor.Commands.TypeCharCommandArgs&gt;.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CommandHandlers.AbstractCompletionCommandHandler.ExecuteCommandWorker[TCommandArgs](TCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CommandHandlers.AbstractCompletionCommandHandler.Microsoft.CodeAnalysis.Editor.ICommandHandler&lt;Microsoft.CodeAnalysis.Editor.Commands.TypeCharCommandArgs&gt;.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.&lt;&gt;c__DisplayClass6_1`1.&lt;ExecuteHandlers&gt;b__1()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller.Microsoft.CodeAnalysis.Editor.ICommandHandler&lt;Microsoft.CodeAnalysis.Editor.Commands.TypeCharCommandArgs&gt;.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CommandHandlers.SignatureHelpCommandHandler.ExecuteCommandWorker[TCommandArgs](TCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.CommandHandlers.SignatureHelpCommandHandler.Microsoft.CodeAnalysis.Editor.ICommandHandler&lt;Microsoft.CodeAnalysis.Editor.Commands.TypeCharCommandArgs&gt;.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.&lt;&gt;c__DisplayClass6_1`1.&lt;ExecuteHandlers&gt;b__1()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.ExecuteReturnOrTypeCommand(CommandArgs args, Action nextHandler, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.&lt;&gt;c__DisplayClass6_1`1.&lt;ExecuteHandlers&gt;b__1()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.DocumentationComments.AbstractXmlTagCompletionCommandHandler.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.&lt;&gt;c__DisplayClass6_1`1.&lt;ExecuteHandlers&gt;b__1()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameCommandHandler.HandlePossibleTypingCommand(CommandArgs args, Action nextHandler, Action`1 actionIfInsideActiveSpan)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameCommandHandler.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.ExecuteHandlers[T](IList`1 commandHandlers, T args, Action lastHandler)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.Microsoft.CodeAnalysis.Editor.ICommandHandlerService.Execute[T](IContentType contentType, T args, Action lastHandler)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.ExecuteTypeCharacter(IntPtr pvaIn, ITextBuffer subjectBuffer, IContentType contentType, Action executeNextCommandTarget)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.ExecuteVisualStudio2000(Guid&amp; pguidCmdGroup, UInt32 commandId, UInt32 executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.Exec(Guid&amp; pguidCmdGroup, UInt32 commandId, UInt32 executeInformation, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.&lt;&gt;c.&lt;DispatchTextInputEvents&gt;b__6_0(KeyProcessor p, TextCompositionEventArgs args)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.&lt;&gt;c__DisplayClass10_1`1.&lt;Dispatch&gt;b__0()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)</description>
  </entry>
miloush commented 3 years ago

Got this in 16.8.0 Preview 2.0 after typing (int)char. into C# Interactive.

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: span
   at Microsoft.VisualStudio.Text.Implementation.TrackingSpan..ctor(ITextVersion version, Span span, SpanTrackingMode trackingMode)
   at Microsoft.VisualStudio.Text.Implementation.TextVersion.CreateTrackingSpan(Span span, SpanTrackingMode trackingMode, TrackingFidelityMode trackingFidelity)
   at Microsoft.VisualStudio.Text.Implementation.BaseSnapshot.CreateTrackingSpan(Span span, SpanTrackingMode trackingMode)
   at Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Implementation.AsyncCompletionSession.<>c__DisplayClass120_0.<UpdateUiInner>b__1()
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)