FolderBrowserDialog not opening in fsharp script #14110
kevinhayesanderson
started this conversation in
General
Replies: 1 comment
-
I think it's the same issue as mentioned in Here's the comment describing what's happening in details: #12023 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am having a simple script to select a folder,
the process is not responding on call to ShowDialog(),
below are script file, runtime config file and cli command to run,
I think i'm missing something or my understanding is wrong,
test.fsx
`
#I @"C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.10\ref\net6.0"
#r "System.Windows.Forms"
open System
open System.Windows.Forms
let folderPath = new Label()
let button = new Button(Text = "Select Folder")
let ini_dir = @"C:\Users\hayeskev\source\Workspaces"
let openFolderHandler =
EventHandler(fun _ _ ->
let folderDlg = new FolderBrowserDialog()
folderDlg.InitialDirectory <- ini_dir
folderDlg.ShowNewFolderButton <- true
let dlgResult = folderDlg.ShowDialog()
if dlgResult.Equals(DialogResult.OK) then
folderPath.Text <- folderDlg.SelectedPath
else
folderPath.Text <- "Error")
button.Click.AddHandler(openFolderHandler)
let layout = new FlowLayoutPanel(Dock=DockStyle.Fill)
layout.Controls.Add(button)
layout.Controls.Add(folderPath)
let form = new Form()
form.Controls.Add(layout)
form.ShowDialog()
`
C:\Program Files\dotnet\sdk\6.0.402\FSharp\fsi.runtimeconfig.json


{ "runtimeOptions": { "tfm": "net6.0", "frameworks": [ { "name": "Microsoft.NETCore.App", "version": "6.0.10" }, { "name": "Microsoft.WindowsDesktop.App", "version": "6.0.10" } ], "configProperties": { "System.Reflection.Metadata.MetadataUpdater.IsSupported": false } } }
running using
dotnet fsi test.fsx
Beta Was this translation helpful? Give feedback.
All reactions