We've had an application written in C# running somewhere for a few years. After a few years, at random times the application crashed. It doesn't hang but just closed itself.
I started by adding a lot of logging through log4net to a textfile. This way i discovered the application crashed on invoking a method from another class.
log.Info("Class OPC - groupRead_DataChanged() - " + "beelden van inputname " + inputname + " op cameo zetten");
try
{
cameoControl1.Invoke(new Action(() => cameoControl1.AddCameras(CameraGrid)));
}
catch (Exception exc)
{
log.Info("Class OPC - groupRead_DataChanged() - " + "cameoControl1.Invoke werkte niet. " + exc);
log.Error("Class OPC - groupRead_DataChanged() - " + "cameoControl1.Invoke werkte niet. " + exc.Message);
log.Error("Class OPC - groupRead_DataChanged() - " + "cameoControl1.Invoke werkte niet. " + exc.InnerException);
log.Error("Class OPC - groupRead_DataChanged() - " + "cameoControl1.Invoke werkte niet. " + exc.Source);
log.Error("Class OPC - groupRead_DataChanged() - " + "cameoControl1.Invoke werkte niet. " + exc.StackTrace);
log.Error("Class OPC - groupRead_DataChanged() - " + "cameoControl1.Invoke werkte niet. " + exc.TargetSite);
}
log.Info("Class OPC - groupRead_DataChanged() - " + "beelden van inputname " + inputname + " staan nu op cameo 1");
}
The log files show "beelden van inputname..... op cameo zetten". But then, nothing... it doesn't even get to the logs in the catch.
I've set it up to create dump files on crash which gave me the following information:
Exception Code: 0xC0000005
Exception Information: The thread tried to read from or write to a virtual address for which it does not have appropriate access
After looking this up, I came to the conclusion that there are multiple causes possible: https://www.stellarinfo.com/blog/how-to-fix-error-code-0xc0000005-in-windows/
RAM could be defect, disk errors, ... We have 3 of the same PC's with a variant of this application. Only 1 has these issues. So I made an image of another one, restored it on the faulty PC and put the correct application on it. The issue remained.
So now I'm wondering, could it really be a hardware defect? How can defect RAM cause this kind of issues? Wouldn't the OS (Windows 10) be taking care of it?