-
Notifications
You must be signed in to change notification settings - Fork 234
Fix uncaught exception when SafeToString returns null #1140
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
Conversation
Complexity increasing per file
==============================
- src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetails.cs 1
Clones added
============
- test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs 4
See the complete overview on Codacy |
@@ -815,6 +815,34 @@ public async Task DebuggerVariableHashtableDisplaysCorrectly() | |||
this.powerShellContext.AbortExecution(); | |||
} | |||
|
|||
[Fact] | |||
public async Task DebufferVariableNullStringDisplaysCorrectly() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests don't actually get run in CI as of right now because of the large migration but you don't need to worry about that. I'm going to enable them again soon.
Thanks for adding this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to run it locally but honestly wasn't sure if it actually ran, had no failures (that were related to this though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just ran the following locally on powershell-preview in vscode
The debugger values are I'm not aware of any other null like values, happy to test any other if they exist. In any case Thanks @TylerLeonhardt for guiding me through this process. |
|
Fixes PowerShell/vscode-powershell#2386
Some values return
null
from.ToString()
. This PR makes sure we check for null and return the type information if it is null.A simple way to test this out is to store a var like
$var = [NullString]::Value
and debug the script with breakpoints. The powershell extension will error out.