Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when pressing enter on a line with only a /* */ comment #11056

Closed
0xd4d opened this issue May 4, 2016 · 3 comments
Closed
Assignees
Milestone

Comments

@0xd4d
Copy link

0xd4d commented May 4, 2016

bug1-1

Version Used:

VS2015 Update 2

Steps to Reproduce:

  • Create a new C# Console project or use an existing C# project
  • Add a new line and add this comment: /* */ (the space after the first * is required)
  • Move the caret to just before the first /* example: |/* where | is the caret
  • Press ENTER

Expected Behavior:

No exception

Actual Behavior:

An exception is thrown and a message box is shown.

As can be seen from the call stack, 'length' param to Span's ctor is -2 which is invalid.

>   Microsoft.VisualStudio.Text.Data.dll!Microsoft.VisualStudio.Text.Span..ctor(int start = 0x000000FA, int length = 0xFFFFFFFE)
    Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Text.Implementation.BaseSnapshot.GetText(int startIndex = 0x000000FA, int length = 0xFFFFFFFE)
    Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.CSharp.BlockCommentEditing.BlockCommentEditingCommandHandler.GetPaddingOrIndentation(Microsoft.VisualStudio.Text.ITextSnapshotLine currentLine = {Microsoft.VisualStudio.Text.Implementation.TextSnapshotLine}, int caretPosition = 0x000000F8, int firstNonWhitespacePosition = 0x000000F8, string exteriorText = "/*")
    Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.CSharp.BlockCommentEditing.BlockCommentEditingCommandHandler.GetExteriorTextForNextLine(Microsoft.VisualStudio.Text.SnapshotPoint caretPosition = {Microsoft.VisualStudio.Text.SnapshotPoint})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.BlockCommentEditing.AbstractBlockCommentEditingCommandHandler.TryHandleReturnKey(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.BlockCommentEditing.AbstractBlockCommentEditingCommandHandler.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.<ExecuteHandlers>b__1()
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.DocumentationComments.AbstractDocumentationCommentCommandHandler<Microsoft.CodeAnalysis.CSharp.Syntax.DocumentationCommentTriviaSyntax, Microsoft.CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax>.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.<ExecuteHandlers>b__1()
    Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.Snippets.AbstractSnippetCommandHandler.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.<ExecuteHandlers>b__1()
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Controller.Microsoft.CodeAnalysis.Editor.ICommandHandler<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.CommandHandlers.AbstractCompletionCommandHandler.ExecuteCommandWorker<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.CommandHandlers.AbstractCompletionCommandHandler.Microsoft.CodeAnalysis.Editor.ICommandHandler<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.<ExecuteHandlers>b__1()
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.ExecuteReturnOrTypeCommand(Microsoft.CodeAnalysis.Editor.CommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action}, System.Threading.CancellationToken cancellationToken = {System.Threading.CancellationToken})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.<ExecuteHandlers>b__1()
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Formatting.Indentation.AbstractSmartTokenFormatterCommandHandler.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>.<ExecuteHandlers>b__1()
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameCommandHandler.ExecuteCommand(Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action nextHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.ExecuteHandlers<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>(System.Collections.Generic.IList<Microsoft.CodeAnalysis.Editor.ICommandHandler<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>> commandHandlers = {System.Collections.Generic.List<Microsoft.CodeAnalysis.Editor.ICommandHandler<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>>}, Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action lastHandler = {System.Action})
    Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.Microsoft.CodeAnalysis.Editor.ICommandHandlerService.Execute<Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs>(Microsoft.VisualStudio.Utilities.IContentType contentType = {Microsoft.VisualStudio.Utilities.Implementation.ContentTypeImpl}, Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs args = {Microsoft.CodeAnalysis.Editor.Commands.ReturnKeyCommandArgs}, System.Action lastHandler = {System.Action})
    Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.ExecuteReturn(Microsoft.VisualStudio.Text.ITextBuffer subjectBuffer = {Microsoft.VisualStudio.Text.Implementation.TextBuffer}, Microsoft.VisualStudio.Utilities.IContentType contentType = {Microsoft.VisualStudio.Utilities.Implementation.ContentTypeImpl}, System.Action executeNextCommandTarget = {System.Action})
    Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.ExecuteVisualStudio2000(ref System.Guid pguidCmdGroup = {System.Guid}, uint commandId = 0x00000003, uint executeInformation = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000, Microsoft.VisualStudio.Text.ITextBuffer subjectBuffer = {Microsoft.VisualStudio.Text.Implementation.TextBuffer}, Microsoft.VisualStudio.Utilities.IContentType contentType = {Microsoft.VisualStudio.Utilities.Implementation.ContentTypeImpl})
    Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.Exec(ref System.Guid pguidCmdGroup = {System.Guid}, uint commandId = 0x00000003, uint executeInformation = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(ref System.Guid pguidCmdGroup = {System.Guid}, uint nCmdID = 0x00000003, uint nCmdexecopt = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(ref System.Guid pguidCmdGroup = {System.Guid}, uint nCmdID = 0x00000003, uint nCmdexecopt = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(ref System.Guid pguidCmdGroup = {System.Guid}, uint nCmdID = 0x00000003, uint nCmdexecopt = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindow.Exec(ref System.Guid pguidCmdGroup = {System.Guid}, uint nCmdID = 0x00000003, uint nCmdexecopt = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    Microsoft.VisualStudio.Platform.WindowManagement.dll!Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.Exec(ref System.Guid pguidCmdGroup = {System.Guid}, uint nCmdID = 0x00000003, uint nCmdexecopt = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    Microsoft.VisualStudio.Platform.WindowManagement.dll!Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Exec(ref System.Guid pguidCmdGroup = {System.Guid}, uint nCmdID = 0x00000003, uint nCmdexecopt = 0x00000000, System.IntPtr pvaIn = 0x00000000, System.IntPtr pvaOut = 0x00000000)
    [Native to Managed Transition]
@davkean
Copy link
Member

davkean commented May 4, 2016

Thanks // cc @DiryBoy

@pawchen
Copy link
Contributor

pawchen commented May 4, 2016

Thank you. This will be addressed at the same time with #11057

@davkean
Copy link
Member

davkean commented May 11, 2016

Thanks for bug report, this will appear in the next update of Visual Studio 2015.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants