I can't seem to make my package export anything at all(for Visual Studio), using MEF.
For example, code:
1) GetClassifier is never called, despite what ContentType might be(Any/Text/Code/etc)
2) In fact, ClassificationSambanProvider is never initialized at all, how do I know this? In deep visual studio implementation, there's a part where all the providers are imported, as such:
The thing is, my provider is not there. Using VS2013! Never had this problem in VS2012. Is there any secret attribute I should apply? Why is my Provider never initiated?
It seems to me that there's problem with MEF, and importing. It does not seem to import stuff from my package?!
When I do the MEF test myself, it works:
It seems that the Visual Studio never calls the AssemblyCatalog() on my Package.
For example, code:
[Export(typeof(IClassifierProvider))]
[ContentType("Code")]
public class ClassificationSambanProvider : IClassifierProvider
{
IClassifierProvider.GetClassifier(ITextBuffer textBuffer)
{
return null;
}
}
I have done some serious debugging, and I've found out that:1) GetClassifier is never called, despite what ContentType might be(Any/Text/Code/etc)
2) In fact, ClassificationSambanProvider is never initialized at all, how do I know this? In deep visual studio implementation, there's a part where all the providers are imported, as such:
[ImportMany]
public List<IClassifierProvider> Providers { get; set; }The thing is, my provider is not there. Using VS2013! Never had this problem in VS2012. Is there any secret attribute I should apply? Why is my Provider never initiated?
It seems to me that there's problem with MEF, and importing. It does not seem to import stuff from my package?!
When I do the MEF test myself, it works:
var catalog = new AssemblyCatalog
(System.Reflection.Assembly.GetExecutingAssembly());
try
{
var container = new CompositionContainer(catalog);
container.ComposeParts(this); // after this, Providers includes my provider.
}
catch (Exception e)
{
}It seems that the Visual Studio never calls the AssemblyCatalog() on my Package.
C#/C++ | WPF/DirectShow/OpenGL/Winapi/