.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Transaction.GetObject() throwing error

3 REPLIES 3
Reply
Message 1 of 4
d_gray
447 Views, 3 Replies

Transaction.GetObject() throwing error

Hi,

I am getting the following error when using Transaction.GetObject() command "Operation is not valid due to the current state of the object."

I have an ObjectIdCollection that i loop round and try

Dim ent As aaDS.Entity = CType(t.GetObject(oid, OpenMode.ForRead), aaDS.Entity)

I've used the same line of code a good few times but this morning it's not playing ball and throwing the above error.

Is there any way i can check the current state of the object to find out what is wrong so that i know where to look? Or any pointers in general?

Thanks
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: d_gray

Hi.

I'm not sure if this will help but it's worth a try.

Try to lock the document and when you are done dispose the lock.
Autodesk.AutoCAD.ApplicationServices.DocumentLock documentLock =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();

Regards

Peter



wrote in message news:5617442@discussion.autodesk.com...
Hi,

I am getting the following error when using Transaction.GetObject() command
"Operation is not valid due to the current state of the object."

I have an ObjectIdCollection that i loop round and try

Dim ent As aaDS.Entity = CType(t.GetObject(oid, OpenMode.ForRead),
aaDS.Entity)

I've used the same line of code a good few times but this morning it's not
playing ball and throwing the above error.

Is there any way i can check the current state of the object to find out
what is wrong so that i know where to look? Or any pointers in general?

Thanks
Message 3 of 4
d_gray
in reply to: d_gray

Thanks Peter, I finally figured out that i hadn't disposed of a transaction!
Message 4 of 4
rakeshkava
in reply to: d_gray

can i get to know what u exactly did u solve the issue a sample piece of code would be more useful

thanks in advance

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost