Prism/MEF application doesnt work on non-developer's machines

Topics: Prism v4 - WPF 4
Dec 24, 2012 at 9:49 AM

Hello

 

I'm facing following problem. 

I've got a MEF/Prism application with different kinds of MEF components (UI ones, simple logical classes etc). On machines where MS VS 2010 installed everything works ok. But when I'm trying to launch it on clean machine it throws following exception:

Application: Visioneer.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Reflection.ReflectionTypeLoadException
Stack:
   at System.Reflection.RuntimeModule.GetTypes(System.Reflection.RuntimeModule)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator()
   at System.Linq.Enumerable+d__14`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
   at System.Linq.Enumerable+d__14`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
   at Microsoft.Practices.Prism.MefExtensions.DefaultPrismServiceRegistrar.GetRequiredPrismPartsToRegister(System.ComponentModel.Composition.Hosting.AggregateCatalog)
   at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.RegisterDefaultTypesIfMissing()
   at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.Run(Boolean)
   at FI.VMRT.Visioneer.App.OnStartup(System.Windows.StartupEventArgs)
   at System.Windows.Application.<.ctor>b__1(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunInternal(System.Windows.Window)

As far as I understand it cannot load some types or something... But I cannot figure out what is excactly wrong/ Can someone help me with this problem?

BTW is it required to install any kind of additional runtime for Prism/MEF on non-dev machines?

 

Thank you!

Developer
Dec 26, 2012 at 1:10 PM

Hi,

Based on my understanding the main requirement to run your Prism application, will be to ensure that you have the corresponding version of the .Net Framework installed on your client machine. Other than that, as far as I know the application should be ready to run as long as the expected folder structure and relative locations of the executable shell application, the module DLLs, and the content files are maintained when deploying the application.

On the other hand, perhaps your application has dependencies that are not in the base installation, in which case they should be included when deploying it to the client machine. As a quick test you could try setting Copy Local=True to your referenced assemblies.

I hope you find this helpful,

Agustin Adami
http://blogs.southworks.net/aadami

Apr 22, 2014 at 10:04 AM
Did you ever find a solution to this? I am experiencing the same error now for the first time.