The problem is that the application closes without any errors, VS remains open. I have several dynamically created ones FileSystemWatchers
, all of them have an event handler in the "Created" event. Therefore, this event handler method is as follows:
void watcher_FileCreated(object sender, FileSystemEventArgs e)
{
FileInfo f1 = new FileInfo(e.FullPath);
filesDataGrid.Rows.Add(f1.Name);
foreach (TLPclass table in parameterForm.getParameters)
{
}
}
The line that causes the program to close is the one where I add the file name in. DataGridView - filesDataGrid.Rows.Add(f1.Name);
Also works OK without this line. It is strange that the application starts normally when it is launched from an .exe file in the projects folder. I do not see an error in my code, but I think that something is terribly wrong with this if it does not even display an error message. And - what are the most common reasons why a program could simply shut down without warning?
source
share