The example below demonstrate that, if there is already a text file with that name at the destination.
Try
// TextOutputStream.Create raises an IOException if it can't open the file for some reason.
Dim t As TextOutputStream = TextOutputStream.Create(f)
t.Write(ConvertEncoding(TextField1.Text, Encodings.UTF8))
t.Close
Catch e As IOException
// handle
End Try
The crash (in the running IDE) happens on the TextOutputStream.Create(f). The error is a Nil exception.
Now that hours ellapsed, I realized that it is my fault: I do not checked Locked
I was so surprised (the error was to lock the file; Id better do as usual: make a copy of the files and use them as replacement instead of licking them ) that I said loud: Its a Bug (my code, the LR example code crashed !)
Also, Juilia is correct: I do not trapped the correct Exception.
So, thank you for your answers, forget this converation and have a nice Sunday all !
Nota: I use this code example since the down of times or
Emile, by default the debugger will stop at the line that causes an exception unless you have Break On Exceptions turned off. What you are seeing seems to be the correct behavior. If you press Resume or step through the code, it should continue through a Catch e as NilObjectException block, assuming you had one. What you are seeing does not indicate that there is a bug in Try/Catch. It appears to be normal debugger behavior.