We help IT Professionals succeed at work.

An unhandled exception of type 'System.Runtime.InteropServices.COMException'

aio419
aio419 asked
on
Medium Priority
1,845 Views
Last Modified: 2012-08-14
I am trying to get some block info from an Autocad drawing using vb.net.
It was working fine with autocad 2005.When we upgraded to autocad 2006, it is crashing.
The first one is having problem is in the line
Dim CurrentSpace As String
CurrentSpace = AppObj.ActiveDocument.ActiveLayout.Block.Name '  
          This is returning >> "*Paper_Space"

For I = 0 To AppObj.ActiveDocument.Blocks.Count – 1    ‘ERROR IS HERE ’
Where Friend WithEvents AppObj As Autodesk.AutoCAD.Interop.AcadApplication
The error is
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in DrawingIndexer.exe

Additional information: No database

If I look in the quick watch window for AppObj.ActiveDocument.Blocks this is the error
Blocks      <error: an exception of type: {System.Runtime.InteropServices.COMException} occurred>
Type:      Autodesk.AutoCAD.Interop.Common.AcadBlocks
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Did you readd the reference to the Autocad, or are you using the same wrapper class?

Bob

Author

Commented:
Yes,I readded the references. (named Autocad 2006 Type Library and AxdbLib.(16.0) type library)
from the COM tab

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Ok, so the developers have changed the interface for the type library, and you need to figure out how.  I don't know what that would be exactly.

Bob

Author

Commented:
Thanks for the reply.
I trying to find out why it is not working for acad 2006  with
AppObj.ActiveDocument.Blocks.Count  giving no database error.

Do i need to add any other references or is there any change for Acad 2006 for this.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
The type libraries for 2006 have been renamed, so did you add a reference to the new name?  Do you still have 2005 installed?

Bob
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
The Autocad 2006 CD has documentation and samples that might help explain your problems.

Bob

Author

Commented:
i do not have 2005 installed. I removed the reference for 2005 and added 2006 references.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
I am out of ideas.

Bob

Author

Commented:
After a struggle I figured out that it is a bug in Autocad and got a hot fix them to patch it.
It is working now.
Thanks for your replay though.
Commented:
Closed, 35 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.