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

ComException was unhandled

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
424 Views, 2 Replies

ComException was unhandled

Hi to all!!!

 

I have this problem running an app with vb.net 2010 and autocad 2014, this app was developunderf vb6 and autocad 2002 and I made little changes to make it work with autocad 2014 using vb.net 2010 but keeps this error i tried to figure out but still the error,

Can you help me with this?

this is the code:

Dim dpuntos(0 To 11) As Double

dpuntos(0) = 0 : dpuntos(1) = 0 : dpuntos(2) = 0
dpuntos(3) = CType(txtTankD.Text, Double) : dpuntos(4) = 0 : dpuntos(5) = 0
dpuntos(6) = CType(txtTankD.Text, Double) : dpuntos(7) = CType(txtOilLevel.Text, Double) : dpuntos(8) = 0
dpuntos(9) = 0 : dpuntos(10) = CType(txtOilLevel.Text, Double) : dpuntos(11) = 0

acuadro = adDibujo.ModelSpace.AddPolyline(dpuntos)
acuadro.Closed = True

and it crash on acuadro= adDibujo.modelspace.addpolyline(dpuntos)

 

Can someone take a look and help me?

 

Thanks for your reply.

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

Your code looks OK.

 

I did tests with an exe that automate AutoCAD and draw a polyline in model space, with both AutoCAD2012 and AutoCAD2015. What I found is that this issue only occurs with my AutoCAD 2015 when running the code from VS for debugging. That is, if I start the EXE from VS debugging, then the code

 

AcadDocument.ModelSpace.AddPolyline(...)

 

raises the error. Interestingly, if I place a break point at the line of code and when the break point is hit and I let the code continue (F10/11), no error at all, the polyline is created successfully. Also, of I run the code with AutoCAD2015 without debugging (i.e. running the EXE normally), again, no error at all and the polyline created correctly.

 

Using the same code with AutoCAD2012, no problem, in debugging mode or not.

 

So, it looks like the issue is probably started with AutoCAd2013 when the big separation of AutoCAD core with Acad.exe and the 64bit AutoCAD and 32-bit VS debugging process may be the root of the issue.

 

Anyway, it looks like a pure issue of the debugging because of the tool (Visual Studio). As AutoCAD customization programmers, we used to a quite some debugging difficulties over the years and this may just be one of them.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3
Anonymous
in reply to: norman.yuan

Thank you for your Reply,

 

Yes I was testing this issue, like you said, if I put break points and then continue debbuging with F10 or F5, this continue with no problem, also this happend in all after the line ADDpoliline, or ADD something, and I put a Thread sleep, it works for the first 5 times, but the issue came up again, I'm almost finish the proyect to generate the .exe and make sure this not happen again, but on the mean time i think this is a temporally solution.

 

Thanks, if I have another problem I keep you inform.

 

 

 

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