Asked by:
MEF exception running an existing VS 2010 application after installing VS 2012

Question
-
Hello,
We have a WPF application written against .NET 4.0 in VS 2010.
Since installing VS 2012, the application no longer functions correctly, reporting this error when trying to compose objects with MEF:
Our code has not changed, this source control revision was working fine before the installation of VS 2012. Any ideas?
Thanks,
Stevemscorlib.dll!System.Collections.Generic.Dictionary<int,System.__Canon>.this[int].get(int key) + 0x49 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.GenericSpecializationPartCreationInfo.BuildMembersTable(System.Collections.Generic.List<System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo> members) + 0x205 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.GenericSpecializationPartCreationInfo.BuildTables() + 0xb4 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.GenericSpecializationPartCreationInfo.TranslateExpot.AnonymousMethod__d() + 0x21 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.GetAccessors() + 0x22 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.ToReflectionMember(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo lazyMember) + 0xd bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition.GetIndex() + 0x19 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.GetExportingMemberFromDefinition(System.ComponentModel.Composition.Primitives.ExportDefinition definition = {System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition}) + 0x33 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.RequiresActivation.AnonymousMethod__b(System.ComponentModel.Composition.Primitives.ExportDefinition definition) + 0x8 bytes > System.Core.dll!System.Linq.Enumerable.Any<System.ComponentModel.Composition.Primitives.ExportDefinition>(System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> source, System.Func<System.ComponentModel.Composition.Primitives.ExportDefinition,bool> predicate = {Method = {System.Reflection.RuntimeMethodInfo}}) Line 1177 + 0xc bytes C# System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.RequiresActivation() + 0x60 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.GetInstanceActivatingIfNeeded() + 0x5e bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.NotifyImportSatisfied() + 0x2f bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.Activate() + 0x32 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.PartManager.TryOnComposed() + 0x29 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(System.ComponentModel.Composition.Hosting.ImportEngine.PartManager partManager = {System.ComponentModel.Composition.Hosting.ImportEngine.PartManager}, System.ComponentModel.Composition.Primitives.ComposablePart part = {System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart}) + 0x279 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(System.ComponentModel.Composition.Hosting.ImportEngine.PartManager partManager = {System.ComponentModel.Composition.Hosting.ImportEngine.PartManager}, System.ComponentModel.Composition.Primitives.ComposablePart part, bool shouldTrackImports = true) + 0xd4 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImports(System.ComponentModel.Composition.Primitives.ComposablePart part) + 0x6a bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(System.ComponentModel.Composition.Hosting.ImportEngine engine, System.ComponentModel.Composition.Primitives.ComposablePart part = {System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart}, System.ComponentModel.Composition.Primitives.ExportDefinition definition = {System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition}) + 0x23 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogPart part = {System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogPart}, System.ComponentModel.Composition.Primitives.ExportDefinition export, bool isSharedPart = true) + 0x4f bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore() + 0x30 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Primitives.Export.Value.get() + 0x3a bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ImportingItem.Cast(System.Type type = {Name = "ITabDataPublisher`1" FullName = "XXX.ITabDataPublisher`1[[XXX.WidgetEventArgs, XXX, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null]]"}, System.ComponentModel.Composition.Primitives.Export export = {System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport}) + 0x1b bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ImportingItem.CastSingleExportToImportType(System.Type type, System.ComponentModel.Composition.Primitives.Export export) + 0x4f bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ImportingItem.CastExportsToSingleImportType(System.ComponentModel.Composition.Primitives.Export[] exports) + 0x4d bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ImportingItem.CastExportsToImportType(System.ComponentModel.Composition.Primitives.Export[] exports) + 0x2f bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.SetImport(System.ComponentModel.Composition.ReflectionModel.ImportingItem item = {System.ComponentModel.Composition.ReflectionModel.ImportingParameter}, System.ComponentModel.Composition.Primitives.Export[] exports) + 0x29 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.SetImport(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> exports) + 0x68 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.PartManager.TrySetImport(System.ComponentModel.Composition.Primitives.ImportDefinition import = {System.ComponentModel.Composition.ReflectionModel.ReflectionParameterImportDefinition}, System.ComponentModel.Composition.Primitives.Export[] exports = {System.ComponentModel.Composition.Primitives.Export[1]}) + 0x30 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(System.ComponentModel.Composition.Hosting.ImportEngine.PartManager partManager = {System.ComponentModel.Composition.Hosting.ImportEngine.PartManager}, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition> imports, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition = null) + 0x16f bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(System.ComponentModel.Composition.Hosting.ImportEngine.PartManager partManager = {System.ComponentModel.Composition.Hosting.ImportEngine.PartManager}, System.ComponentModel.Composition.Primitives.ComposablePart part = {System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart}) + 0xef bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(System.ComponentModel.Composition.Hosting.ImportEngine.PartManager partManager = {System.ComponentModel.Composition.Hosting.ImportEngine.PartManager}, System.ComponentModel.Composition.Primitives.ComposablePart part, bool shouldTrackImports = true) + 0xd4 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImports(System.ComponentModel.Composition.Primitives.ComposablePart part) + 0x6a bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(System.ComponentModel.Composition.Hosting.ImportEngine engine, System.ComponentModel.Composition.Primitives.ComposablePart part = {System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart}, System.ComponentModel.Composition.Primitives.ExportDefinition definition = {System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition}) + 0x23 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogPart part = {System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogPart}, System.ComponentModel.Composition.Primitives.ExportDefinition export, bool isSharedPart = true) + 0x4f bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore() + 0x30 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.Primitives.Export.Value.get() + 0x3a bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ExportServices.GetCastedExportedValue<XXX.IPlugin>(System.ComponentModel.Composition.Primitives.Export export) + 0x29 bytes System.ComponentModel.Composition.dll!System.ComponentModel.Composition.ExportServices.CreateStronglyTypedLazyOfTM<XXX.IPlugin,XXX.IPluginMetadata>.AnonymousMethod__1() + 0x28 bytes mscorlib.dll!System.Lazy<XXX.IPlugin>.CreateValue() + 0xb5 bytes mscorlib.dll!System.Lazy<XXX.IPlugin>.LazyInitValue() + 0x17f bytes mscorlib.dll!System.Lazy<XXX.IPlugin>.Value.get() + 0x4c bytes XXX.dll!XXX.PluginManager.GetPlugin(System.Guid pluginGuid = {System.Guid}) + 0x255 bytes XXX.dll!XXX.Tab.Tab(System.Xml.Linq.XElement tabElement = {System.Xml.Linq.XElement}, System.Collections.Generic.IList<System.Lazy<XXX.IPlugin,XXX.IPluginMetadata>> plugins = Count = 29) + 0x4d6 bytes XXX.dll!XXX.Page.Page(System.Xml.Linq.XElement pageElement = {System.Xml.Linq.XElement}, System.Collections.Generic.IList<System.Lazy<XXX.IPlugin,XXX.IPluginMetadata>> plugins = Count = 29) + 0x277 bytes XXX.dll!XXX.PluginManager.RestoreController(System.Xml.Linq.XElement controllerElement = {System.Xml.Linq.XElement}) + 0x1c4 bytes XXX.dll!XXX.PluginManager.Initialize() + 0xb0 bytes XXX.dll!XXX.MainFrameWindow.MainFrameWindowLoaded(object sender = {XXX.MainWindow}, System.Windows.RoutedEventArgs e = {System.Windows.RoutedEventArgs}) + 0x203 bytes PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) Line 66 + 0x6d bytes Unknown PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {XXX.MainWindow}, System.Windows.RoutedEventArgs args = {System.Windows.RoutedEventArgs}, bool reRaised = false) Line 205 Unknown PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {XXX.MainWindow}, System.Windows.RoutedEventArgs args = {System.Windows.RoutedEventArgs}) Line 2352 + 0x11 bytes Unknown PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs e) Line 431 + 0x9 bytes Unknown PresentationFramework.dll!System.Windows.BroadcastEventHelper.BroadcastEvent(System.Windows.DependencyObject root, System.Windows.RoutedEvent routedEvent = {System.Windows.RoutedEvent}) Line 276 + 0x12 bytes C# PresentationFramework.dll!System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(object root) Line 178 C# PresentationCore.dll!MS.Internal.LoadedOrUnloadedOperation.DoWork() Line 37 + 0xe bytes Unknown PresentationCore.dll!System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() Line 1988 + 0x1d bytes Unknown PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() Line 1961 Unknown PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget = {System.Windows.Interop.HwndTarget}) Line 1826 Unknown PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget) Line 1721 Unknown PresentationCore.dll!System.Windows.Media.MediaContext.Resize(System.Windows.Media.ICompositionTarget resizedCompositionTarget) Line 1697 + 0x13 bytes Unknown PresentationCore.dll!System.Windows.Interop.HwndTarget.OnResize() Line 1280 Unknown PresentationCore.dll!System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage msg, System.IntPtr wparam, System.IntPtr lparam) Line 741 + 0x7 bytes Unknown PresentationCore.dll!System.Windows.Interop.HwndSource.HwndTargetFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled = false) Line 1326 + 0xe bytes Unknown WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 657712, int msg = 5, System.IntPtr wParam = 0, System.IntPtr lParam = 42599250, ref bool handled = false) Line 345 + 0x16 bytes Unknown WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Line 494 + 0x18 bytes Unknown WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 111 + 0xa bytes Unknown WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate method, object args, int numArgs, System.Delegate catchHandler = null) Line 41 + 0x17 bytes Unknown WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1447 + 0x2d bytes Unknown WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 657712, int msg = 5, System.IntPtr wParam = 0, System.IntPtr lParam = 42599250) Line 398 Unknown [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 672 + 0x29 bytes Unknown [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 424 + 0x1a bytes Unknown [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 672 + 0x29 bytes Unknown [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 424 + 0x1a bytes Unknown [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!MS.Win32.UnsafeNativeMethods.CriticalSetWindowLong(System.Runtime.InteropServices.HandleRef hWnd, int nIndex, System.IntPtr dwNewLong) Line 680 + 0x10 bytes Unknown PresentationFramework.dll!System.Windows.Window.Flush() Line 7086 C# PresentationFramework.dll!System.Windows.Window.HwndStyleManager.System.IDisposable.Dispose() Line 8166 C# PresentationFramework.dll!System.Windows.Window.OnWindowStyleChanged(System.Windows.WindowStyle windowStyle) Line 5435 + 0xffffffde bytes C# PresentationFramework.dll!System.Windows.Window._OnWindowStyleChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e) Line 5414 + 0x2a bytes C# WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) Line 2082 + 0x28 bytes Unknown PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) Line 2069 + 0x22 bytes C# WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) Line 1756 + 0x21 bytes Unknown WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {System.Windows.DependencyProperty}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) Line 1570 + 0x8d bytes Unknown WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal) Line 839 + 0x2a bytes Unknown WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) Line 428 + 0x15 bytes Unknown PresentationFramework.dll!System.Windows.Window.WindowStyle.set(System.Windows.WindowStyle value) Line 1488 + 0x2d bytes C# DevComponents.WpfRibbon.dll!DevComponents.WpfRibbon.RibbonWindow.x1e0e26dea320cd4e() + 0x3e4 bytes DevComponents.WpfRibbon.dll!DevComponents.WpfRibbon.RibbonWindow.x4c80d3d35cdbb83e() + 0xd2 bytes DevComponents.WpfRibbon.dll!DevComponents.WpfRibbon.RibbonWindow.OnSourceInitialized(System.EventArgs e = {System.EventArgs}) + 0x49 bytes PresentationFramework.dll!System.Windows.Window.CreateSourceWindow(bool duringShow) Line 2591 + 0x21 bytes C# PresentationFramework.dll!System.Windows.Window.CreateSourceWindowDuringShow() Line 2458 + 0xa bytes C# PresentationFramework.dll!System.Windows.Window.SafeCreateWindowDuringShow() Line 5545 + 0xc bytes C# PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) Line 5646 C# PresentationFramework.dll!System.Windows.Window.Show() Line 211 + 0x1d bytes C# XXX.dll!XXX.LoginWindowViewModel.OpenMainWindow() Line 61 + 0xd bytes C# XXX.dll!XXX.LoginWindow.OpenMainWindow() Line 155 + 0x10 bytes C# XXX.dll!XXX.LoginWindow.OnLoginSuccess(object sender = {XXX.LoginWindowViewModel}, System.EventArgs e = {System.EventArgs}) Line 150 + 0x8 bytes C# XXX.dll!XXX.LoginWindowViewModel._sigma_LoginSuccess(object sender = {XXX.XXXApplication}, System.EventArgs e = {System.EventArgs}) Line 149 + 0x11 bytes C# XXX.dll!XXX.XXXApplication.worker_RunWorkerCompleted(object sender = {System.ComponentModel.BackgroundWorker}, System.ComponentModel.RunWorkerCompletedEventArgs e = {System.ComponentModel.RunWorkerCompletedEventArgs}) Line 307 + 0x14 bytes C# System.dll!System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(System.ComponentModel.RunWorkerCompletedEventArgs e) Line 115 + 0xb bytes C# System.dll!System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(object arg) Line 48 + 0x23 bytes C# WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 118 + 0xa bytes Unknown WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate method, object args, int numArgs, System.Delegate catchHandler = null) Line 41 + 0x17 bytes Unknown WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Line 556 + 0x3f bytes Unknown WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) Line 500 + 0x7 bytes Unknown mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Line 414 Unknown WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Line 2227 Unknown WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 2480 Unknown WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 395648, int msg = 49708, System.IntPtr wParam = 0, System.IntPtr lParam = 0, ref bool handled = false) Line 345 + 0x16 bytes Unknown WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Line 494 + 0x18 bytes Unknown WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 111 + 0xa bytes Unknown WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate method, object args, int numArgs, System.Delegate catchHandler = null) Line 41 + 0x17 bytes Unknown WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1447 + 0x2d bytes Unknown WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 395648, int msg = 49708, System.IntPtr wParam = 0, System.IntPtr lParam = 0) Line 398 Unknown [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) Line 2281 + 0x35 bytes Unknown WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) Line 368 + 0x9 bytes Unknown WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() Line 327 + 0x34 bytes Unknown PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Line 2745 C# PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Line 1841 C# PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) Line 261 + 0x9 bytes C# PresentationFramework.dll!System.Windows.Application.Run() Line 222 + 0x15 bytes C# XXXApp.exe!XXXApp.AppStartup.Main(string[] args = {string[0]}) Line 38 + 0xa bytes C# [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.AppDomain.nExecuteAssembly(System.Reflection.RuntimeAssembly assembly, string[] args) + 0x9 bytes mscorlib.dll!System.Runtime.Hosting.ManifestRunner.Run(bool checkAptModel) + 0x6f bytes mscorlib.dll!System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() + 0x90 bytes mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext, string[] activationCustomData) + 0x65 bytes mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext) + 0xd bytes mscorlib.dll!System.Activator.CreateInstance(System.ActivationContext activationContext) + 0x44 bytes Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() + 0x20 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes [Native to Managed Transition]
- Edited by Stephen Drew Thursday, August 16, 2012 9:10 PM
- Moved by CoolDadTx Friday, August 17, 2012 2:03 AM MEF related (From:Visual C# General)
Thursday, August 16, 2012 9:09 PM
All replies
-
Hello,
This seems to be an issue with a change in behaviour of [InheritedExport] applied to open generic types.
This change affects code written against MefContrib open generics, which works with 4.0 and fails with 4.5. The same behaviour is observed using the built-in open generics in 4.5.
Example code:
//[InheritedExport] interface ITest<T> { } [Export(typeof(ITest<>))] class TestClass<T> : ITest<T> { } class Program { static void Main(string[] args) { var catalog = new AssemblyCatalog(typeof(Program).Assembly); var container = new CompositionContainer(new GenericCatalog(catalog)); var tests = container.GetExportedValues<ITest<string>>(); } }
The code works fine if the Export is declared on the exporting type; however, if this Export attribute is commented out and the InheritedExport attribute is commented back in, the code fails.
This affects existing applications developed against 4.0 once 4.5 is installed on the machine.
Hope this helps,
Steve
Friday, August 17, 2012 10:11 AM -
It's not only a problem using InheritedExport. I have a similar problem using the
GenericContractRegistryBase
and the
GenericCatalog
from the codeplex mefcontrib-project.
I get an error saying that there are more than one exports, but there is only one generic type in the parts and my GenericContractRegistry implementation.
It works perfect before installing Visual Studio 2012.
After deinstalling VS2012 and .net framework 4.5 (and additionally reinstalling VS2010!?) everything worked as before...Wednesday, September 26, 2012 6:50 AM