I am trying to get a file path via SaveFileDailog and then use a StreamWriter to actually create the file and then write the data. But it does not work. I get an exception saying the file is in use by another process. Which doesn't make any sense, since I have disposed of the SaveFileDialog and ran garbage collection...
This is my code so far.
let dialog = new SaveFileDialog()
let result = dialog.ShowDialog()
let file =
match result with
| DialogResult.OK ->dialog.OpenFile()
| _ -> failwith "cancel"
let path = dialog.FileName
dialog.Dispose()
let result = null
let dialog = null
GC.Collect()
let writer = (File.CreateText(path))
I am sure it is just something silly, but I would still like help with it.