Message 1 of 3
Using Xrecord and Binary Serialization

Not applicable
03-13-2007
01:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
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