Error "Attempting to read or write protected memory" while reading AutoCad databases

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);
        // Do Stuff
    }
});
+4
source share
2 answers

As Miiir mentioned , AutoCAD does not support multithreading.

AutoCAD Console (accoreconsole.exe). (.exe), , NETLOAD .NET, . , .

AutoCAD Console 8- . , ( ). PDF : .NET- Core Console AutoCAD®

enter image description here

+4

AutoCAD .

+2

Source: https://habr.com/ru/post/1616277/


All Articles