Closed ghost closed 2 years ago
I'm sorry, after a few hours I'm giving up on producing a useful example case. It seems like this only happens in large and complex scripts with lots of defined variables, which if true means a minimal example is literally impossible. It definitely happens on a textDocument/completion
call but we already knew that.
After some wrangling I got tee
capturing of both input and output set up (this is surprisingly difficult to do on Windows) in the hopes that a trimmed-down canned input could be used to trigger the problem, but alas, feeding canned input to PSES appears to be a non-trivial job that requires specific timing.
I un-gave up and took a different approach and I now seem to have a reasonably-sized script that triggers it, and a decent log of the input from Kate for the entire session. Attached are (privacy sanitized) stdin and stdout from PSES, plus the script file (renamed with an additional .txt suffix to bypass GitHub restrictions).
The error triggers upon typing the $
for the value of key
, so the easiest way to see it if you can in fact reproduce is to delete it, then save the file and type it again.
Hey, I was able to repro this! Interestingly the VS Code client doesn't crash after that fails, but the null reference exception is certainly happening, so we can hopefully get this fixed ASAP. Thank you so much for the detailed repro info!!! 🥳🥳🥳
@andschwa Ah, excellent to know it reproduces on VS Code! I guess the VS Code extension just doesn't complain about exceptions as loudly as Kate's LSP client.
Fixed with a regression test!
The completion code shouldn't throw errors so it's probably worth creating an issue in https://github.com/PowerShell/PowerShell to fix the underlying issue.
Thanks so much @MartinGC94!
Hi @alexbuzzbee! We just got this fixed in v3.6.0, can you verify for us?
Well, I don't seem to be able to reproduce it anymore and it looks like the underlying issue has a fix committed too. Seems good to me. Thanks!
Prerequisites
Steps to reproduce
I have PowerShell Editor Services configured in KDE Kate using a script that does essentially:
Sometimes, when I am typing a variable reference, PowerShell Editor Services throws a null reference exception. When it happens, it happens repeatedly, but I don't yet know the exact conditions. I will try to find specific trigger conditions tomorrow.
Expected behavior
Either a completion is offered successfully or fails silently.
Actual behavior
An exception is thrown, which is displayed in the editor window distractingly. (In Kate this is especially bad because the Output window pops up, grabbing keyboard focus.)
Error details
Environment data
Version
3.5.1
Visuals
No response