I am getting "Attempted to Read or write protected memory" when I try to perform some parallel operations. I am reading AutoCad Databases into to memory to do some data mining. I can do this with a regular for
loop but not with a Parallel.ForEach
. Any ideas?
Parallel.ForEach(_Files, (currentFile) =>
{
var _File = currentFile;
using (Database _Database = new Database(false, true))
{
_Database.ReadDwgFile(_File, FileOpenMode.OpenForReadAndAllShare, false, null);
_Database.CloseInput(true);
// Do Stuff
}
});