acad.exe not stopping when close acad

acad.exe not stopping when close acad

Anonymous
Not applicable
2,096 Views
13 Replies
Message 1 of 14

acad.exe not stopping when close acad

Anonymous
Not applicable
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
2,097 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable
Hi Mark,

Despite this is a VBA newsgroup and you are far less likely to find the
expertise you need here compared with the .NET newsgroup, or the
Microsoft newsgroups related to .NET


On 8/04/2010 3:11 AM, mp wrote:
> I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
> it uses com interop though it's dotnet vb2008 express so am asking here as
> well as dotnet
>
> I keep running into the problem, just the last couple days, that after
> testing the app, then closing acad to rebuild the dll,
> acad is not closing - it closes on the screen, but acad.exe is still in the
> process list in task mgr.
>
> I kept ending the process via task mgr, since that was the only thing i
> could do...but after a couple times of that acad quit working properly and i
> had to do a repair install tody.
>
> now it's still doning the same thing again, closes but acad.exe stil running
>
> how to fix?
> thanks
> mark

--

Regards

Laurie Comerford Edited by: Discussion_Admin on Apr 9, 2010 10:38 AM
0 Likes
Message 3 of 14

Anonymous
Not applicable
I know, but, just in case, i posted here, in case it was more a com issue
that someone here might know as well.
wasn't sure i'd get an answer on the net group due to their focus on the
acad net api
As it turns out tony was gracious enough to clear it up anyway.
thanks
mark

"Laurie Comerford" wrote in message
news:6369187@discussion.autodesk.com...
Hi Mark,

Despite Tony's attempts to discourage users from posting anything that
doesn't suit his distorted personal viewpoint of the .NET newsgroups,
this is a VBA newsgroup and you are far less likely to find the
expertise you need here compared with the .NET newsgroup, or the
Microsoft newsgroups related to .NET


On 8/04/2010 3:11 AM, mp wrote:
> I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
> it uses com interop though it's dotnet vb2008 express so am asking here as
> well as dotnet
>
> I keep running into the problem, just the last couple days, that after
> testing the app, then closing acad to rebuild the dll,
> acad is not closing - it closes on the screen, but acad.exe is still in
> the
> process list in task mgr.
>
> I kept ending the process via task mgr, since that was the only thing i
> could do...but after a couple times of that acad quit working properly and
> i
> had to do a repair install tody.
>
> now it's still doning the same thing again, closes but acad.exe stil
> running
>
> how to fix?
> thanks
> mark

--

Regards

Laurie Comerford
0 Likes
Message 4 of 14

Anonymous
Not applicable
I think it would be best if someone from Autodesk would actually speak up and tell us what they think the groups are for and their reason.

I could post VB.NET code using the ActiveX API here and nobody would realise it was not VBA. But if I mentioned the magical .NET term there would be outrage.
0 Likes
Message 5 of 14

Anonymous
Not applicable
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 6 of 14

Anonymous
Not applicable
The problem is in your code.

The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 7 of 14

Anonymous
Not applicable
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 8 of 14

Anonymous
Not applicable
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 9 of 14

Anonymous
Not applicable
You said this happens when you run your code in the
debugger. Do you allow AutoCAD to close, or do you
just click "Stop Debugging" in visual studio?

If the latter, do you really not understand why your
Terminate() method isn't getting called ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380163@discussion.autodesk.com...
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 10 of 14

Anonymous
Not applicable
I don't click "stop debugging" in vbexpress.
I build the dll.
I open acad via shortcut on desktop.
dll is netloaded by startup routine.
i enter the command at command line that is defiined in the dll.
that runs the test and should create and destroy the objects defined in dll.
when the objects are destroyed, the ref to the acad app and doc should be
destroyed along with them, i would think.
I close acad with the x in the top right corner of editor window.
i go back to vbexpress ide, edit whatever, click build to rebuild the dll.
i get the error, can't copy ...blah... dll is in use by other process...or
whatever the exact phrasing is...

sorry if i wasn't clear about that in op
thanks
mark



"Tony Tanzillo" wrote in message
news:6380198@discussion.autodesk.com...
You said this happens when you run your code in the
debugger. Do you allow AutoCAD to close, or do you
just click "Stop Debugging" in visual studio?

If the latter, do you really not understand why your
Terminate() method isn't getting called ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380163@discussion.autodesk.com...
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 11 of 14

Anonymous
Not applicable
You haven't posted any relevant code related to this, and
you seem to be expecting others to guess what your code
does.

How you get the AcadApplication object has nothing to
do with the problem you have.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380797@discussion.autodesk.com...
I don't click "stop debugging" in vbexpress.
I build the dll.
I open acad via shortcut on desktop.
dll is netloaded by startup routine.
i enter the command at command line that is defiined in the dll.
that runs the test and should create and destroy the objects defined in dll.
when the objects are destroyed, the ref to the acad app and doc should be
destroyed along with them, i would think.
I close acad with the x in the top right corner of editor window.
i go back to vbexpress ide, edit whatever, click build to rebuild the dll.
i get the error, can't copy ...blah... dll is in use by other process...or
whatever the exact phrasing is...

sorry if i wasn't clear about that in op
thanks
mark



"Tony Tanzillo" wrote in message
news:6380198@discussion.autodesk.com...
You said this happens when you run your code in the
debugger. Do you allow AutoCAD to close, or do you
just click "Stop Debugging" in visual studio?

If the latter, do you really not understand why your
Terminate() method isn't getting called ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380163@discussion.autodesk.com...
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 12 of 14

Anonymous
Not applicable
in my ignorance i assumed it might since it's the acad application that's
hanging
i have no idea which part of the code is causing the problem so don't know
which part to post.

per your original response
The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

so although i'm not using axdb i am using acaddoc so that's why i asked if
the finalize sub might help the problem
is Finalize the same as Terminate in vb6?
should destroying the acaddoc and acadapp refs go there?
Protected Overrides Sub Finalize()

m_acadDoc = Nothing

m_acadApp = Nothing

m_util.OpenDebugLog()

m_util = Nothing

MyBase.Finalize()

End Sub

does that look right? (assuming the variable names are obvious enough)

thanks for your patience.

mark


"Tony Tanzillo" wrote in message
news:6380965@discussion.autodesk.com...
You haven't posted any relevant code related to this, and
you seem to be expecting others to guess what your code
does.

How you get the AcadApplication object has nothing to
do with the problem you have.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380797@discussion.autodesk.com...
I don't click "stop debugging" in vbexpress.
I build the dll.
I open acad via shortcut on desktop.
dll is netloaded by startup routine.
i enter the command at command line that is defiined in the dll.
that runs the test and should create and destroy the objects defined in dll.
when the objects are destroyed, the ref to the acad app and doc should be
destroyed along with them, i would think.
I close acad with the x in the top right corner of editor window.
i go back to vbexpress ide, edit whatever, click build to rebuild the dll.
i get the error, can't copy ...blah... dll is in use by other process...or
whatever the exact phrasing is...

sorry if i wasn't clear about that in op
thanks
mark



"Tony Tanzillo" wrote in message
news:6380198@discussion.autodesk.com...
You said this happens when you run your code in the
debugger. Do you allow AutoCAD to close, or do you
just click "Stop Debugging" in visual studio?

If the latter, do you really not understand why your
Terminate() method isn't getting called ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380163@discussion.autodesk.com...
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 13 of 14

Anonymous
Not applicable
Your problem is that you are using Object.Finalize(), which
you are not supposed to use, because it runs in a thread
that cannot access any AutoCAD APIs.

Do not override Finalize(), it is for very advanced use only,
and because it runs in a seperate thread, it is dangerous
in an environement that is not thread-safe.

If your code is a NETLOADed DLL, there is no need to do
anything you're doing in your Finalize().

I've no idea what your m_util.OpenDebugLog() call is doing,
so I would have to assume it's doing something that can't be
done from the thread that Object.Finalize() is called from.

If you need to do something when you are finished using
your class, then have your class implement IDisposable,
and in the Dispose() method, do whatever cleanup and
finalization you need to do. Then, you must explicitly call
Dispose() when you are finished using the instance.

You can find plenty of material on what IDisposable is on
the web, that should help you better understand it and how
it's used.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6381082@discussion.autodesk.com...
in my ignorance i assumed it might since it's the acad application that's
hanging
i have no idea which part of the code is causing the problem so don't know
which part to post.

per your original response
The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

so although i'm not using axdb i am using acaddoc so that's why i asked if
the finalize sub might help the problem
is Finalize the same as Terminate in vb6?
should destroying the acaddoc and acadapp refs go there?
Protected Overrides Sub Finalize()

m_acadDoc = Nothing

m_acadApp = Nothing

m_util.OpenDebugLog()

m_util = Nothing

MyBase.Finalize()

End Sub

does that look right? (assuming the variable names are obvious enough)

thanks for your patience.

mark


"Tony Tanzillo" wrote in message
news:6380965@discussion.autodesk.com...
You haven't posted any relevant code related to this, and
you seem to be expecting others to guess what your code
does.

How you get the AcadApplication object has nothing to
do with the problem you have.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380797@discussion.autodesk.com...
I don't click "stop debugging" in vbexpress.
I build the dll.
I open acad via shortcut on desktop.
dll is netloaded by startup routine.
i enter the command at command line that is defiined in the dll.
that runs the test and should create and destroy the objects defined in dll.
when the objects are destroyed, the ref to the acad app and doc should be
destroyed along with them, i would think.
I close acad with the x in the top right corner of editor window.
i go back to vbexpress ide, edit whatever, click build to rebuild the dll.
i get the error, can't copy ...blah... dll is in use by other process...or
whatever the exact phrasing is...

sorry if i wasn't clear about that in op
thanks
mark



"Tony Tanzillo" wrote in message
news:6380198@discussion.autodesk.com...
You said this happens when you run your code in the
debugger. Do you allow AutoCAD to close, or do you
just click "Stop Debugging" in visual studio?

If the latter, do you really not understand why your
Terminate() method isn't getting called ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380163@discussion.autodesk.com...
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes
Message 14 of 14

Anonymous
Not applicable
Tony, Thanks for your response.

"Tony Tanzillo" wrote in message
news:6381304@discussion.autodesk.com...
Your problem is that you are using Object.Finalize(), which
you are not supposed to use, because it runs in a thread
that cannot access any AutoCAD APIs.

Do not override Finalize(), it is for very advanced use only,
and because it runs in a seperate thread, it is dangerous
in an environement that is not thread-safe.

---
thanks for that. I'm just tweaking a preexisting net dll that was written
by someone no longer here.
that overridden Finalize was there so I assumed it was the place to dispose
of objects...
---


If your code is a NETLOADed DLL, there is no need to do
anything you're doing in your Finalize().

I've no idea what your m_util.OpenDebugLog() call is doing,

---
oddly enough, it's opening a debug log. 🙂
Sub OpenDebugLog()

Process.Start(m_DebugFileName)

End Sub

---


so I would have to assume it's doing something that can't be
done from the thread that Object.Finalize() is called from.

---
i don't know if that can run from that thread
---

If you need to do something when you are finished using
your class, then have your class implement IDisposable,
and in the Dispose() method, do whatever cleanup and
finalization you need to do. Then, you must explicitly call
Dispose() when you are finished using the instance.

You can find plenty of material on what IDisposable is on
the web, that should help you better understand it and how
it's used.

---
Thanks i'll do some research.
Appreciate your time and infomation
Thank you
mark
---

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6381082@discussion.autodesk.com...
in my ignorance i assumed it might since it's the acad application that's
hanging
i have no idea which part of the code is causing the problem so don't know
which part to post.

per your original response
The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

so although i'm not using axdb i am using acaddoc so that's why i asked if
the finalize sub might help the problem
is Finalize the same as Terminate in vb6?
should destroying the acaddoc and acadapp refs go there?
Protected Overrides Sub Finalize()

m_acadDoc = Nothing

m_acadApp = Nothing

m_util.OpenDebugLog()

m_util = Nothing

MyBase.Finalize()

End Sub

does that look right? (assuming the variable names are obvious enough)

thanks for your patience.

mark


"Tony Tanzillo" wrote in message
news:6380965@discussion.autodesk.com...
You haven't posted any relevant code related to this, and
you seem to be expecting others to guess what your code
does.

How you get the AcadApplication object has nothing to
do with the problem you have.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380797@discussion.autodesk.com...
I don't click "stop debugging" in vbexpress.
I build the dll.
I open acad via shortcut on desktop.
dll is netloaded by startup routine.
i enter the command at command line that is defiined in the dll.
that runs the test and should create and destroy the objects defined in dll.
when the objects are destroyed, the ref to the acad app and doc should be
destroyed along with them, i would think.
I close acad with the x in the top right corner of editor window.
i go back to vbexpress ide, edit whatever, click build to rebuild the dll.
i get the error, can't copy ...blah... dll is in use by other process...or
whatever the exact phrasing is...

sorry if i wasn't clear about that in op
thanks
mark



"Tony Tanzillo" wrote in message
news:6380198@discussion.autodesk.com...
You said this happens when you run your code in the
debugger. Do you allow AutoCAD to close, or do you
just click "Stop Debugging" in visual studio?

If the latter, do you really not understand why your
Terminate() method isn't getting called ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380163@discussion.autodesk.com...
no that didn't help.
the first time through it works ok, acad closes when i close it.

the second time, acad window closes but remains in running process

setting the document to nothing did not solve the problem
what else can i try?
thanks
mark

"mp" wrote in message
news:6380177@discussion.autodesk.com...
my refs to acadapp and acaddoc happen in Init method on a utility object
when they Finalize acadapp is set to nothing...i didn't think to set acaddoc
to nothing also
should that happen in finalize?
i understand dotnet is different from vb6 where objects go out of scope at
proceedure end?
in Finalize()
m_AcadDoc = Nothing <--- would that do it?
(assuming m_AcadDoc is class level private member variable initialized in
.Init)
thanks
mark

"Tony Tanzillo" wrote in message
news:6380191@discussion.autodesk.com...
The problem is in your code.

the problem is always in my code! 🙂



The most common cause of acad.exe not terminating, is
when a database is not destroyed. That could be for example,
an AxDbDocument that has an outstanding reference that
prevents the database from being destroyed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6380027@discussion.autodesk.com...
I'm still having this problem.
I fixed the acad reference from GetObject to
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

but acad is still not closing if I get an error during debugging....

I keep having to restart the computer because if i end acad process after a
while acad gets messed up and i have to reinstall

any ideas of how to solve this?

ps, i am trapping the error with try catch, doesn't prevent the problem

thanks

mark



"mp" wrote in message
news:6368780@discussion.autodesk.com...
I'm debugging a new vb.net app (acad 2009 and dotnet vb2008 express )
it uses com interop though it's dotnet vb2008 express so am asking here as
well as dotnet

I keep running into the problem, just the last couple days, that after
testing the app, then closing acad to rebuild the dll,
acad is not closing - it closes on the screen, but acad.exe is still in the
process list in task mgr.

I kept ending the process via task mgr, since that was the only thing i
could do...but after a couple times of that acad quit working properly and i
had to do a repair install tody.

now it's still doning the same thing again, closes but acad.exe stil running

how to fix?
thanks
mark
0 Likes