I have a problem with Studio APIs DwgLoadProcedure.
My code is this:
{color:#0000ff}DwgLoadProcedure loadProcedure = new DwgLoadProcedure();
loadProcedure.SourceFiles.Add(@file);
loadProcedure.RootPath = myRoot;
loadProcedure.CoordinateSystem = coordSys;
loadProcedure.ClosedPolylinesToPolygons = false;
loadProcedure.Generalization = 100;
loadProcedure.GenerateSpatialDataSources = true;
loadProcedure.SpatialDataSourcesFolder = "Data";
loadProcedure.SpatialDataSourcesPath = "";
loadProcedure.GenerateLayers = false;
loadProcedure.GenerateMaps = false;
loadProcedure.GenerateSymbolLibraries = true;
loadProcedure.SymbolLibrariesFolder = "Symbols";
loadProcedure.SymbolLibrariesPath = "";
loadProcedure.Execute(connection);{color}
At the line {color:#0000ff}loadProcedure.Execute(connection), {color}the app throws an error:
{color:#ff0000}System.AccessViolationException was unhandled by user code
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="Autodesk.MapGuide.Studio.Dwg.Load"
StackTrace:
at BlockConverter.Convert(BlockConverter* , AcDbBlockTableRecord* )
at Autodesk.MapGuide.Studio.Load.DwgLoadProcedure.BlocksToSymbols(String srcFile, AcDbDatabase* pDb, PackageWriter pkg, SiteConnection connection)
at Autodesk.MapGuide.Studio.Load.DwgLoadProcedure.WriteSymbolsOnly(PackageWriter pkg, SiteConnection connection)
at Autodesk.MapGuide.Studio.Load.DwgLoadProcedure.Execute(String packageFilePath, SiteConnection connection)
at Autodesk.MapGuide.Studio.Load.LoadProcedure.Execute(SiteConnection connection)
{color}
{color:#000000}I've done the same with DwfLoadProcedure and that works perfectly!{color} It's something to do with the symbol library. If I make this change {color:#0000ff} loadProcedure.GenerateSymbolLibraries = false, {color:#000000}the error doesn't occur but, ...well you can imagine how a dwg looks like without a symbol library, just lines and points....
I know that in Studio 2009 they made some changes with handling dwgs. But this has to be possible somehow!
Any advices are appreaciated!
Tanja
{color}{color}