Using Xrecord and Binary Serialization

Using Xrecord and Binary Serialization

Anonymous
Not applicable
526 Views
2 Replies
Message 1 of 3

Using Xrecord and Binary Serialization

Anonymous
Not applicable
I am using this function to retreive xrecord data save along with the drawing
public TypedValue[] loadByteStream(string dictionary)
{
TypedValue[] bts=null;
try
{
using(Transaction trans=db.TransactionManager.StartTransaction())
{

DBDictionary NOD = (DBDictionary)trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
DBDictionary dictLegs = (DBDictionary)trans.GetObject(NOD.GetAt(dictionary), OpenMode.ForRead);
Xrecord XRec = (Xrecord)trans.GetObject(dictLegs.GetAt(dictionary), OpenMode.ForRead);
trans.Commit();
bts=XRec.Data.AsArray() ;
}
}
catch(Autodesk.AutoCAD.Runtime.Exception exp)
{
ed.WriteMessage(exp.Message);
}
return bts;
}
the problem is when i work with drawing using the .net debug mode it work smoothly
however when i open acad separately and use netload to load the application
it gives Fatal Error
i am definite that line bts=XRec.Data.AsArray() ; is causing the exception.
Any Solution.
PS: this happens for some drawings not all
0 Likes
527 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
It wouldn't suprise me that you get this, but I think
its most likely linked to what's in the xrecord. If you
can't get it into an array, that's not just a significant
issue, its a show stopper that should never have made
it into a production release.

So, can you post an example DWG file with an xrecord
that throws the exception?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5516211@discussion.autodesk.com...
I am using this function to retreive xrecord data save along with the drawing
public TypedValue[] loadByteStream(string dictionary)
{
TypedValue[] bts=null;
try
{
using(Transaction trans=db.TransactionManager.StartTransaction())
{

DBDictionary NOD = (DBDictionary)trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
DBDictionary dictLegs = (DBDictionary)trans.GetObject(NOD.GetAt(dictionary), OpenMode.ForRead);
Xrecord XRec = (Xrecord)trans.GetObject(dictLegs.GetAt(dictionary), OpenMode.ForRead);
trans.Commit();
bts=XRec.Data.AsArray() ;
}
}
catch(Autodesk.AutoCAD.Runtime.Exception exp)
{
ed.WriteMessage(exp.Message);
}
return bts;
}
the problem is when i work with drawing using the .net debug mode it work smoothly
however when i open acad separately and use netload to load the application
it gives Fatal Error
i am definite that line bts=XRec.Data.AsArray() ; is causing the exception.
Any Solution.
PS: this happens for some drawings not all
0 Likes
Message 3 of 3

Anonymous
Not applicable
As Requested please find attached the dwg file causing the mentioned errors

The dictionary name is ISODRAWING

let me know if more clarification is required to finalize this issue Message was edited by: ckassouf
0 Likes