I work with a server-side application written in C# and I perform a simple Task.Run
like this:
{
...
Task.Run(() => DeleteFile(path));
...
}
It worked for years, but since yesterday it stopped working and the DeleteFile method is not called at all. The execution just continues to the next line of code. I tried Task.Run(() => File.Delete(path))
, which doesn't work as well. Then I added Task.Wait
as follows (with an empty action - just for test):
Task t = Task.Run(() => {});
t.Wait();
When the execution reaches t.Wait()
it waits forever and doesn't go to the next line of code.
Other places in the application where I use Task.Run work properly.
What might be the reason?