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

Reg. NET DLL Error

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
1070 Views, 4 Replies

Reg. NET DLL Error

 

I have created one class that return the list of all Text Object from the active drawing an dI am getting the below mentioned error can anyone please tell me what do you mean by this error ?

 

If you need more clarification what I have done let me know..

 

An unhandled exception of type 'System.AccessViolationException' occurred in AcdbMgd.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

 

 

 

4 REPLIES 4
Message 2 of 5
norman.yuan
in reply to: Anonymous

The error mesage does not not help much for any one to guess what could be the reason of it. You need to show some code.

 

If I have to guess from your limited description, obtaining a list of DBObject (DBText in your case) and passing it outside an transaction could be one of the possible reasons. As best-practice approach, you only pass around ObjectId or a collection of ObjectIds and only open DBObject by ObjectId in an Transaction and be done with the DBObject before the Transaction ends.

 

Again, only your code would get you helped.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 5
Anonymous
in reply to: Anonymous

could not tell the reason, how about post some snippet of your code?
Message 4 of 5
Anonymous
in reply to: norman.yuan

Yes norman..you are exactly right what you have guessed, that I am returning all DBText object in one List<DBText>.

so as you suggested, the right way is to return the ObjectIDs of all text object from the drawing. Am I right ?
Message 5 of 5
mehdi.Autodesk
in reply to: Anonymous

Dear Bhensdadia,

 

if you have kind of a loop( such as: For each, for, ...) in your sub, and in this loop you want to get and object by id (like: GetObject, GetClass ...) follow this

 

  1. Before your loop start transaction by Using
  2. After your process on object id  (in your case text ids ) Commit the transaction and then end using

in below you can see a sample

 

Public Function textSelect()

 

Dim Tr As Transaction = db.TransactionManager.StartTransaction()

 

'start the transaction

Using Tr

 

'start of Loop

For Each Id As ObjectId In Ids

  

'add your code below (the process need to be done on object id)

 

 

 

 

 

Next

 

'Close the transaction

 

Tr.Commit()

 

End Using

 

return t

 

 End Function

 

I hope it can help Smiley Wink

 Mehdi

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