DisconnectedContext Detected Error

155 views
Skip to first unread message

Sameer Panse

unread,
Sep 21, 2009, 5:04:59 AM9/21/09
to SolidWorks-API
Hi,

In my solidowrks addin i am getting "Disconnected Context Detected"
error at first line of following function -

Overrides Function DetachEventHandlers() As Boolean
RemoveHandler iPart.DestroyNotify, AddressOf
Me.PartDoc_DestroyNotify
RemoveHandler iPart.NewSelectionNotify, AddressOf
Me.PartDoc_NewSelectionNotify

DisconnectModelViews()

userAddin.DetachModelEventHandler(iDocument)
End Function

I have tried no of solutions. But its not working...anyone has faced
this problem?
Any idea how this can be resolved?

Regards,
Sameer

Eduardo

unread,
Sep 25, 2009, 1:09:38 PM9/25/09
to SolidWorks-API
Does that happen when you unload the add-in inside SolidWorks?

Corey Scheich

unread,
Sep 25, 2009, 4:45:56 PM9/25/09
to ebr...@althima.com, solidwo...@googlegroups.com
Are you using the SolidWorks provided template?
Are you referencing the SolidWorks provided interops or did you create new ones by directly referencing the COM Dll.
Is the error present during debug, non-debug or both?
One computer or multiple?


> Date: Fri, 25 Sep 2009 10:09:38 -0700
> Subject: Re: DisconnectedContext Detected Error
> From: ebr...@althima.com
> To: solidwo...@googlegroups.com


Microsoft brings you a new way to search the web. Try Bing™ now

Sameer Panse

unread,
Sep 26, 2009, 5:27:42 AM9/26/09
to SolidWorks-API
no...it happens when I am closing a drawing through solidworks API
using "CloseAllDocuments".

When I debugged, sequence was as follows -
1. Open Drawing
2. Delete all dangling dimensions
3. Scale the drawing
4. Close Drawing

While opening drawing, corresponding part also gets opened. So events
for that part are also attached using AttachEventHandler. Then while
closing drawing, it closes the drawing and while detaching events I
get this error.

any help regarding this would be appreciated.

Thanks,
Sameer

Sameer Panse

unread,
Sep 26, 2009, 5:32:55 AM9/26/09
to SolidWorks-API
yes m using solidworks provided template and m using solidworks
interops.
error is present in both debug/release mode and comes on multiple
computers only when i run through Visual Studio.

If I deploy it on other machine where there is no visual studio
installed...addin works fine with solidworks. i don't get any error.

any help regarding this would be highly appreciated.

Thanks,
Sameer



On Sep 26, 1:45 am, Corey Scheich <cdsmor...@hotmail.com> wrote:
> Are you using the SolidWorks provided template?Are you referencing the SolidWorks provided interops or did you create new ones by directly referencing the COM Dll.Is the error present during debug, non-debug or both?One computer or multiple?
>
>
>
> > Date: Fri, 25 Sep 2009 10:09:38 -0700
> > Subject: Re: DisconnectedContext Detected Error
> > From: ebri...@althima.com
> > To: solidwo...@googlegroups.com
>
> > Does that happen when you unload the add-in inside SolidWorks?
>
> > On 21 Set, 10:04, Sameer Panse <sameerpa...@gmail.com> wrote:
> > > Hi,
>
> > > In my solidowrks addin i am getting "Disconnected Context Detected"
> > > error at first line of following function -
>
> > >     Overrides Function DetachEventHandlers() As Boolean
> > >         RemoveHandler iPart.DestroyNotify, AddressOf
> > > Me.PartDoc_DestroyNotify
> > >         RemoveHandler iPart.NewSelectionNotify, AddressOf
> > > Me.PartDoc_NewSelectionNotify
>
> > >         DisconnectModelViews()
>
> > >         userAddin.DetachModelEventHandler(iDocument)
> > >     End Function
>
> > > I have tried no of solutions. But its not working...anyone has faced
> > > this problem?
> > > Any idea how this can be resolved?
>
> > > Regards,
> > > Sameer
>
> _________________________________________________________________
> Microsoft brings you a new way to search the web.  Try  Bing™ nowhttp://www.bing.com?form=MFEHPG&publ=WLHMTAG&crea=TEXT_MFEHPG_Core_ta...bing_1x1

Sameer Panse

unread,
Sep 26, 2009, 5:35:08 AM9/26/09
to SolidWorks-API
the sequence includes my own workflow (delete dangling dimensions &
scaling) ...for solidworks its just opening and closing drawing.

Regards,
Sameer

Corey Scheich

unread,
Sep 26, 2009, 11:35:46 AM9/26/09
to samee...@gmail.com, solidwo...@googlegroups.com
I have had problems with this before while debugging and never figured out exactly what was causing it.  I have never had related problems in a deployment of the project though, and have deployed quite a few projects under contract for various companies. I have just pushed through the debugging.  I believe there is a setting in VS to ignore this type of check while debugging, but I cannot remember what it was.

Corey

> Date: Sat, 26 Sep 2009 02:35:08 -0700

> Subject: Re: DisconnectedContext Detected Error


Lauren found her dream laptop. Find the PC that’s right for you.

sameer panse

unread,
Sep 26, 2009, 12:01:20 PM9/26/09
to Corey Scheich, solidwo...@googlegroups.com
I had tried that option...its there in Debug->Exceptions->Managed Debugging Assistants in visual studio. But going ahead i got Context switch deadlock error.

As you said, m also not getting it in deployment environment...but it makes my life difficult to debug the code during development.

Anyway thanks Corey!
Reply all
Reply to author
Forward
0 new messages