Search

VSSDK 2008/2010/2012 DTE.Events subscription problem (reproduceable) by Dessus

Closed

1
0
Sign in
to vote
Type: Bug
ID: 775900
Opened: 1/6/2013 12:14:06 AM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
Boxing and unboxing the DTE object doesn't allow event subscriptions to work in the VSSDK all the way back to vs2005 and up to vs 2012.

See my post here:

http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/eb1e8fd1-32ad-498c-98e9-25ee3da71004

http://stackoverflow.com/questions/8775111/dteevents-onstartupcomplete-event-not-working-for-vspackage-vssdk2010/14180361#14180361

http://stackoverflow.com/questions/5405167/dte2-events-dont-fire/14180383#14180383

http://stackoverflow.com/questions/4816801/visual-studio-2010-extension-events-not-called/14180414#14180414

http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/7ec92d44-afa0-4778-bea4-6cbdd658962c?prof=required
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

I believe that boxing and unboxing the DTE object in VS 2005/2008/2010/2012 (I have literally struggled with this since vs 2005 with no solution).

What works:

((DTE)GetService(typeof(DTE))).Events.DebuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode;

What doesn't work:

var services = new Dictionary<Type,Object>();
services .Add(typeof(DTE), ((DTE)GetService(typeof(DTE))));
services[typeof(DTE)].Events.DebuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode;

Things considered by other peoples suggestions:

1) caching Events, and DebuggerEvents objects so that they aren't GC'd

Product Language

English

Operating System

Any

Operating System Language

English

Actual results

DTE events don't work in 80% of cases (consistantly) ie, they work for DTE.Events.DebuggerEvents.OnContextChanged; but not for DTE.Events.DebuggerEvents.OnEnterDesignMode and all of the other events under DTE.Events.DebuggerEvents.*

Expected results

All events behave the same as how OnContextChanged does where it survives being boxed. This is extremely confusing and unexpected behavior for developers. I went on for a long time coming up with elaborate hacks to try and work around those events not working. I also found that in the documentation for the events it says that you shouldn't use them. That lead to the belief they might have been deprecated which I now don't believe to be the case at all.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/5/2013 at 10:53 AM
Hi Dessus, I haven't heard back on this so I'm going to go ahead and close it. Please reactivate as necessary.

Thanks, Tony Goodhew, Program Manager, VS Pro
Posted by Microsoft on 1/29/2013 at 10:34 AM
Hi Dessus, We are unable to repro this issue. Can you provide us with a small project that consistently reproduces the issue.

Thanks, Tony Goodhew, Program Manager, VS Pro
Posted by Microsoft on 1/8/2013 at 12:22 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/6/2013 at 12:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.