When I try to perform some parallel operations, I get "Attempted to read or write protected memory." I read AutoCad Databases in memory to do some data mining. I can do this with a regular loop for, but not with 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);
}
});
source
share