I have this class :
public class TempFileRef
{
public readonly string FilePath;
public TempFileRef(string filePath)
{
FilePath = filePath;
}
~TempFileRef()
{
File.Delete(FilePath); //<== what happens if exception ?
}
}
Question :
What happens if there is an Exception in the destructor ?
1) will it break the other finalization’s in the F-Queue ?
2) I i’ll wrap it with Try and Cache – I will NEVER know that there was an error
3) what should I do here ?
edit
The MSDN pattern for it based on "if I **forget** to call the Dispose method - so the GC will do it eventually.... it is better later then never...". So my question is specially about exception in the Finilize ( destructor)
From MSDN :