Skip to content

Nested errors in debugging not shown in console #2534

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

Closed
ili101 opened this issue Mar 8, 2020 · 2 comments · Fixed by PowerShell/PowerShellEditorServices#1230
Closed

Nested errors in debugging not shown in console #2534

ili101 opened this issue Mar 8, 2020 · 2 comments · Fixed by PowerShell/PowerShellEditorServices#1230
Labels
Resolution-Fixed Will close automatically.

Comments

@ili101
Copy link

ili101 commented Mar 8, 2020

Issue Type: Bug

Example from https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_trap?view=powershell-7#using-the-break-and-continue-keywords

function break_example {
    trap {
        "Error trapped"
        break
    }
    1/$null
    "Function completed."
}

break_example
  1. Save example to file (Optional).
  2. Run with F5.

Expected output (and is working correctly on 2020.2.0):
Error trapped + Error
image

Actual output on 2020.3.0:
No error shown
image

Extension version: 2020.3.0
Tested on PS7 and 5.1
VS Code version: Code 1.42.1 (c47d83b293181d9be64f27ff093689e8e7aed054, 2020-02-11T14:45:59.656Z)
OS version: Windows_NT x64 10.0.17763

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (2 x 3392)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: disabled_off
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: unavailable_off
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 2.00GB (0.22GB free)
Process Argv
Screen Reader no
VM 100%
@ghost ghost added the Needs: Triage Maintainer attention needed! label Mar 8, 2020
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 9, 2020

I can repro this on macOS as well...

image

It only seems to have started occurring in the last update as it doesn't repro in the PowerShell Preview extension

@rjmholt rjmholt changed the title [2020.3.0 new bug] "trap { break }" stopped showing errors when using F5. Nested errors in debugging not shown in console Mar 11, 2020
@rjmholt
Copy link
Contributor

rjmholt commented Mar 11, 2020

Started looking into this, and there's definitely a race condition at work here; in some debugging sessions, choosing the right breakpoints actually gets the errors to print.

We correctly catch the RuntimeException and process it here.

That fires off an Out-Default execution without awaiting it.

When errors are written as expected, they go through this method in our host implementation, but this isn't reliably called...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Fixed Will close automatically.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants