interactive: Out-Gridview in .NET (PowerShell) kernel fails

Hello

Describe the bug

When I try to use Out-Gridview in a code cell of a notebook with .NET (PowerShell) kernel it fails.

Is there any way to use Out-Gridview in a code cell when the notebook kernel is .NET (PowerShell)? I use Out-GridView a lot as a selection tool when the kernel is PowerShell and would like to be able to do it also with .NET (PowerShell). Not being able to do it is something that stops me from adopting the latter.

The problem exists in Azure Data Studio, Jupyter Notebook and VSCode. For more info see: Notebook, Out-Gridview in .NET (PowerShell) kernel fails #17105

In case it is not currently possible, will you be able to advise me where to make the request?

Regards

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ): 1.0.255902+b0afbdc47dec91e62b0c5cb587a0f2c24242eca8

  • OS
    • Windows 11
    • Windows 10
    • Windows Server 2022
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Visual Studio Code Insiders
    • Visual Studio
    • Other (please specify) Azure Data Studio

Screenshots

md5=6d18b72a66c0a13874e22c99f616353c

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (11 by maintainers)

Most upvoted comments

This would be a tough choice - I love the multi-language ability here, especially with SQL and variable sharing but out-gridview is a vital selector tool…

Is there a way to load WPF dlls in the same way one loads other windows system dlls in powershell? The requirement to run such notebooks on widows is not a limitation in our environment.

Get-Credential command was changed in PowerShell Core to not use the pop-up windows, but instead provides the console experience: image

In .NET Interactive Jupyter Notebook, it works as the follows:

image

@daxian-dbw, @jonsequitur

No such module exists today, but potentially it may be possible to have a module (or a nuget package?) that contains all the necessary WPF assemblies.

It seems to me that it would be a very positive thing if we could have a solution in the short term, even if it is specific to Windows, until a multiplatform solution is generated.

The faithful users of Windows (in my case user of Microsoft products since MSDOS 3.x) sometimes we feel that this initiative of your company by the multiplatformity hurts us because there are cases in which it is leveled down using the logic this is multiplatform or nothing.

I find the goal of cross-platform laudable as long as it does not mean that the many millions of Windows users lose functionality that can be achieved with relative ease in our operating system.

Hopefully in this case we can move forward with something Windows-specific (as with Out-GridView in PowerShell 7.x) until the platform-independent solution is available.

It would also require running in STA though.

Honestly I am not concerned in the least for the type of work being done in these cases.

Best regards, Claudio Salvio

Hello @daxian-dbw

Regarding your comment:

“I’m afraid Out-GridView won’t work in .NET Interactive because it depends on WPF. For PowerShell Core, When building package for Windows, we use Microsoft.NET.Sdk.WindowsDesktop instead of Microsoft.NET.Sdk to include the WPF components, and that’s why Out-GridView works in PowerShell Core on Windows.”

it would seem that the most obvious solution is for .Net Interactive to also use Microsoft.NET.Sdk.WindowsDesktop. Is there any obstacle for that to happen?

I consider that in “literate programming” it is very necessary to have interaction mechanisms such as the one offered by Out-GridView.

In my personal case, since a couple of years ago, I work with notebooks almost every day. Because of the way I use them, I usually need to select items from lists and other types of tasks that involve real interactivity.

I raised an issue regarding Out-GridView because it is by far the most necessary for me in this aspect but I understand that this problem is not limited to this function. It also affects other very useful and interactive features such as Show-Command.

As the support for notebooks with PowerShell .NET Interactive kernel was improved I was trying to adopt it but the lack of interactivity is a big obstacle.

Can you think of any other alternative to enjoy the required functionality?

Regards Claudio Salvio

@jonsequitur

Thank you for your prompt reply.

In September 2021, I started the search for a solution to this issue in the Azure Data Studio forum with the issue Notebook, Out-Gridview in .NET (PowerShell) kernel fails #17105 .

Based on the discussion there, I considered the problem to be related to Dotnet Interactive and registered this issue here in November 2021.

Attached is more info regarding the issue obtained using Azure Data Studio (ADS).

In ADS, with the PowerShell kernel (Jupyter Python based) the cell runs normally. The Out-GridView window appears, I can select rows and the $processesToStop variable is assigned with the selected processes. image

In ADS, with the PowerShell kernel (.NET Interactive) the cell execution gives an error when running: “Out-GridView: Exception has been thrown by the target of an invocation.”. The Out-GridView window does not appear and -as expected in this case- $processesToStop is set to null since no selection has been made. image

In Visual Studio Code, with the PowerShell kernel (.NET Interactive) something different happens: the cell keeps running endlessly and the Stop button does not work to stop the execution. To interrupt it, it is necessary to close the VSCode window. image

Let me know if you need any other information.

Best regards, Claudio Salvio