Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

CompositionContractMismatchException in VS 2015 Extension implementing ITeamExplorerSection

$
0
0

Hi there, I'm trying to update my Visual Studio Extension Diff All Files to support Visual Studio 2015.  Everything works fine in VS 2012 and 2013, but in 2015 it throws the following error when I open the Team Explorer Pending Changes Windows, which should show my new control on it:

System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Microsoft.VisualStudio.Composition.NetFxAdapters+MefV1ExportProvider+ComposablePartForExportFactory' to type 'Microsoft.TeamFoundation.Controls.ITeamExplorerSection'.
   at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
   at System.ComponentModel.Composition.ReflectionModel.ExportFactoryCreator.LifetimeContext.GetExportLifetimeContextFromExport[T](Export export)
   at System.ComponentModel.Composition.ReflectionModel.ExportFactoryCreator.<>c__DisplayClass4`2.<CreateStronglyTypedExportFactoryOfTM>b__5()
   at System.ComponentModel.Composition.ExportFactory`1.CreateExport()
   at Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework.TeamExplorerSectionHost.Create()


This blog post explains that VS 2015 moved from MEF v1 to v2, which I think may be part of the problem, but I'm not really sure.  I'm fairly certain that the error occurs when it tries to process the following attribute on my VSPackage control class:

[TeamExplorerSection(PendingChangesSection.SectionId, TeamExplorerPageIds.PendingChanges, 35)]

Any ideas what the problem might be or how to solve it?

The project is open source so you can download it and reproduce the problem if you like.  You can grab the source code from here, just make sure you get the "AddVs2015Support" branch.

Thanks in advance.


- Dan - "Can't never could do anything"


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>