My C# WPF app runs on regular basis and every now and then i keep getting this error attempt to read or write protected memory, this is often indication that other memory is corrupted c#
this is my code. Initially I thought some external app is interfering with my database so i added a code for checking if DB is closed or open. but error seem to somthing else this is driving me crazy.
I am posting the call stack and i see thread 17 has some facts on how the issue was caused.
Link for my drive where i have shared the entire dumpfile please check out thread no 17 [ https://drive.google.com/open?id=0BzWisplLq-PqMlhzaVdFNTJiZjg ]
please help me finding the issue ? i am new to this.
using (var context = Context.Create("C:\\XSR_BIB_V2\\XSR_BIB_V2_DATABASE.sdf", "", 4091))
{
if (DbUpdateLoop.context.Database.Connection.State == System.Data.ConnectionState.Closed)
DbUpdateLoop.context.Database.Connection.Open();
try
{
var data = DbUpdateLoop.context.EnergyPeakInfo_Tbl.Where(x => (my_startTime >= x.StartTime) && (my_stopTime <= x.StopTime)).FirstOrDefault();
}
catch (AccessViolationException aV)
{
//exception is not caught here
}
}