Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I have a drawing file containing some standard blocks. Using this snippet to read drawing from a memory stream:
using (Stream fs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Resources.StandardBlocks.dwg"))
{
using (MemoryStream ms = new MemoryStream())
{
fs.CopyTo(ms);
byte[] bts = ms.ToArray();
GCHandle pinnedArray = GCHandle.Alloc(bts, GCHandleType.Pinned);
IntPtr pointer = pinnedArray.AddrOfPinnedObject();
Database sourceDb = new Database(false, true);
try
{
sourceDb.ReadDwgFile(pointer, false, "");
}
catch(System.Exception e)
{
}
// Some code to work with sourceDb
sourceDb.Dispose();
pinnedArray.Free();
}
}
The point is that: when code reaches ReadDwgFile, autocad crashes without even reaching to catch statement.
if it helps, standardBlocks.dwg contains a block of an OLE excel sheet.
Could you please help
Solved! Go to Solution.