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

[Salsa] Fix InvalidOperationException when attempting to validate a breakpoint location in a script block #12414

Closed
wants to merge 1 commit into from

Conversation

jramsay
Copy link
Contributor

@jramsay jramsay commented Jul 9, 2016

Issue: an InvalidOperationException can occur in Salsa when setting a breakpoint in a script block. This exception is caught but it means the TSLS never gets the request to resolve the breakpoint and thus the breakpoint cannot be set.

The pCodeSpan that is passed to AbstractLanguageService`3.VsLanguageDebugInfo's ValidateBreakpointLocationWorker contains the iStartLine and iEndline for the full HTML document. The snapshot textbuffer is actually only the contained language document though (JS script block). This means the attempt to get the span from the snapshot can fail because the span endline can be larger then the snapshot line count.

Fix: add a check to ensure the span endline is less than the snapshot line count before attempting to get the snapshot.

… breakpoint in a script block. This exception is caught but it means the TSLS never gets the request to resolve the breakpoint and the breakpoint cannot be set.

The pCodeSpan that is passed to AbstractLanguageService`3.VsLanguageDebugInfo's ValidateBreakpointLocationWorker contains the iStartLine and iEndline for the full HTML document. The snapshot textbuffer is actually only the contained language document though (JS script block).  This means the attempt to get the span from the snapshot can fail because the span endline can be larger then the snapshot line count.
Fix: add a check to ensure the span endline is less than the snapsot line count before attempting to get the snapshot.
@jramsay jramsay force-pushed the ValidateBreakpointFixForSalsa branch from 1066068 to 0101645 Compare July 11, 2016 18:16
@jasonmalinowski
Copy link
Member

contains the iStartLine and iEndline for the full HTML document. The snapshot textbuffer is actually only the contained language document though

Does this mean we're missing a mapping between the two documents then? Isn't the right fix to map the start/end lines down to the buffer in question? This seems like it's just working around the issue due an earlier bug.

@jasonmalinowski
Copy link
Member

Review: @dotnet/roslyn-ide

@jramsay
Copy link
Contributor Author

jramsay commented Jul 11, 2016

Perhaps, the snapshot point is retrieved by using the iLine and iCol values - these appear to be correct. It is the attempt to adjust the mapping using the pCodeSpan that causes the issue. The pCodeSpan is passed to Roslyn by vsdebug - will see if I can track down where this is set.

@CyrusNajmabadi
Copy link
Member

I'm also concerned about this. It definitely looks like this is just trying to avoid crashing here due to bad data being introduced into the system at some point.

Note that BP spans should work in Venus/script-block scenarios already. So i'm surpirsed there's an issue here.

@jramsay
Copy link
Contributor Author

jramsay commented Jul 11, 2016

I think I see the difference between the old JSLS and Salsa for this scenario - will add the WTE folks to the internal thread to confirm the issue.

@jaredpar
Copy link
Member

We apologize, but we are closing this PR due to code drift. We regret letting this PR go so long without attention, but at this point the code base has changed too much for us to revisit older PRs. Going forward, we will manage PRs better under an SLA currently under draft in issue #26266 – we encourage you to add comments to that draft as you see fit. Although that SLA is still in draft form, we nevertheless want to move forward with the identification of older PRs to give contributors as much early notice as possible to review and update them.

If you are interested in pursuing this PR, please reset it against the head of master and we will reopen it. Thank you!

@jaredpar jaredpar closed this Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants