Import SVsServiceProvider not working in custom editor

I created my own editor for the WinForms component, which implements UITypeEditor and works fine. The editor should download information from the solution currently open, and I think that this should be done with the DTE from the VisualStudio SDK.

According to the MSDN article ( http://msdn.microsoft.com/en-us/library/ee834473 (v = vs .110) .aspx ) I implemented it exactly like this:

internal class TreeViewTypeEditor : UITypeEditor { [Import] internal SVsServiceProvider ServiceProvider = null; protected override Control GetEditControl(ITypeDescriptorContext context, object value) { // ServiceProvider is NULL here! DTE dte = (DTE)ServiceProvider.GetService(typeof(DTE)); } } 

ServiceProvider will always be null, but why? What am I doing wrong?

+8
c # visual-studio winforms
source share

No one has answered this question yet.

See similar questions:

3
Import SvsServiceProvider in VS 2012

or similar:

1327
Why is it important to override GetHashCode when the Equals method is overridden?
314
Adding Editor Guides in Visual Studio
7
SvcUtil / edb does not generate INotifyPropertyChange when installing DotNET 4.5
4
Avoiding passing context reference among classes
3
Boxing Custom Value Types
2
Collection Editor Data Lost During Development
one
Missing Nuget Component
0
Templated Control - content is not allowed between opening and closing tags
0
Call text to VS extension
-one
C # How to use OADate to convert dates from a database?

All Articles