I keep getting the following error:
System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="FEDivaNET" StackTrace: at Diva.Handles.FEDivaObject.dropReference() at Diva.Handles.FEDivaObject.!FEDivaObject() at Diva.Handles.FEDivaObject.Dispose(Boolean ) at Diva.Handles.FEDivaObject.Finalize() InnerException:
Any ideas what the issue could be? - I'm using a library that is written in C++ and isn't designed for multithreading, yet I'm hammering it about 3000 times with requests every 6 minutes.
CODE
delegate void SetTextCallback(string mxID, string text);
public void UpdateLog(string mxID, string text)
{
//lock (thisLock)
//{
if (listBoxProcessLog.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(UpdateLog);
this.BeginInvoke(d, new object[] { mxID, text });
}
else
{
//Get a reference to the datatable assigned as the datasource.
//DataTable logDT = (DataTable)listBoxProcessLog.DataSource;
//logDT.Rows.Add(DateTime.Now + " - " + mxID + ": " + text);
if (text.Contains("COMPLETE") || (text.Contains("FAILED")))
{
if (progressBar1.Value <= progressBar1.MaxValue)
{ progressBar1.Value += 1; }
}
}
//}
}
Baring in mind that even when the Lock and the DataTable weren't commented out, the error still occurred!
EDIT:
Unfortunately I don't have access to the C++ code, and the C# code is a wrapper around the functions.....basically the library is single threaded, and I'm guessing because it's unManaged that this is occuring.....suggestions?
Appdomains? - Would that work?