I have some code in my application that throws an error every so often (System.AccessViolationException) - So I wrapped it in a try/catch block and set a debug point and logging method in the catch element. I've found that since I did this the error has stopped happening - the debug point is never hit and nothing is logged. As soon as I remove the try from around the code I get the error again. What could be causing this?
The code is pretty trivial:
try
{
var f1 = new ResizeNearestNeighbor(lfu.Width, lfu.Height);
var f2 = new Crop(ViewRectangle);
lfu = f2.Apply(lfu);
lfu = f1.Apply(lfu);
}
catch (Exception ex)
{
MainForm.LogExceptionToFile(ex);//never hit
}