Exception when trying to use MotionTrackingClient in an application

May 10, 2011 at 1:09 AM

Hi Josh,

Everything is fine when running your sample applications, but I'm getting the following exception when I try to create an application that used the MotionTrackingClient. 

Any idea what the issue may be?

Thanks,

Jeff

 

Microsoft.Practices.Unity.ResolutionFailedException was unhandled
  Message=Resolution of the dependency failed, type = "BoggsSystems.Rocky.Shell.Views.ShellView", name = "". Exception message is: The current build operation (build key Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]) failed: The current build operation (build key Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]) failed: Could not load file or assembly 'InfoStrat.MotionFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. (Strategy type DynamicMethodPropertySetterStrategy, index 1) (Strategy type BuildPlanStrategy, index 3)
  Source=Microsoft.Practices.Unity
  TypeRequested=ShellView
  StackTrace:
       at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
       at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name)
       at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name)
       at Microsoft.Practices.Unity.UnityContainerBase.Resolve(Type t)
       at Microsoft.Practices.Unity.UnityContainerBase.Resolve[T]()
       at BoggsSystems.Rocky.Shell.Bootstrapper.CreateShell() in C:\Projects\Way(11.19.10)\Way(10.12.10)\BoggsSystems.Rocky.Shell\Bootstrapper.cs:line 96
       at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
       at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run()
       at BoggsSystems.Rocky.Shell.App.RunInDebugMode() in C:\Projects\Way(11.19.10)\Way(10.12.10)\BoggsSystems.Rocky.Shell\App.xaml.cs:line 32
       at BoggsSystems.Rocky.Shell.App.OnStartup(StartupEventArgs e) in C:\Projects\Way(11.19.10)\Way(10.12.10)\BoggsSystems.Rocky.Shell\App.xaml.cs:line 18
       at System.Windows.Application.<.ctor>b__1(Object unused)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
       at BoggsSystems.Rocky.Shell.App.Main() in C:\Projects\Way(11.19.10)\Way(10.12.10)\BoggsSystems.Rocky.Shell\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Microsoft.Practices.ObjectBuilder2.BuildFailedException
       Message=The current build operation (build key Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]) failed: The current build operation (build key Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]) failed: Could not load file or assembly 'InfoStrat.MotionFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. (Strategy type DynamicMethodPropertySetterStrategy, index 1) (Strategy type BuildPlanStrategy, index 3)
       Source=Microsoft.Practices.ObjectBuilder2
       BuildKey=Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]
       ExecutingStrategyIndex=3
       ExecutingStrategyTypeName=BuildPlanStrategy
       StackTrace:
            at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
            at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
            at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
       InnerException: Microsoft.Practices.ObjectBuilder2.BuildFailedException
            Message=The current build operation (build key Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]) failed: Could not load file or assembly 'InfoStrat.MotionFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. (Strategy type DynamicMethodPropertySetterStrategy, index 1)
            Source=Microsoft.Practices.ObjectBuilder2
            BuildKey=Build Key[BoggsSystems.Rocky.Shell.Views.ShellView, null]
            ExecutingStrategyIndex=1
            ExecutingStrategyTypeName=DynamicMethodPropertySetterStrategy
            StackTrace:
                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, Object buildKey)
                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
            InnerException: System.BadImageFormatException
                 Message=Could not load file or assembly 'InfoStrat.MotionFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
                 Source=mscorlib
                 FileName=InfoStrat.MotionFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
                 FusionLog=Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Projects\Way(11.19.10)\Way(10.12.10)\BoggsSystems.Rocky.Shell\bin\Debug\BoggsSystems.Rocky.Shell.vshost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = JB-PC\JB
LOG: DisplayName = InfoStrat.MotionFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Projects/Way(11.19.10)/Way(10.12.10)/BoggsSystems.Rocky.Shell/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : BoggsSystems.Rocky.Shell, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\Way(11.19.10)\Way(10.12.10)\BoggsSystems.Rocky.Shell\bin\Debug\BoggsSystems.Rocky.Shell.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Projects/Way(11.19.10)/Way(10.12.10)/BoggsSystems.Rocky.Shell/bin/Debug/InfoStrat.MotionFx.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

                 StackTrace:
                      at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
                      at System.Reflection.RuntimeMethodInfo.get_Signature()
                      at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
                      at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
                      at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
                      at Microsoft.Practices.ObjectBuilder2.PropertySelectorBase`1.<SelectProperties>d__0.MoveNext()
                      at Microsoft.Practices.ObjectBuilder2.DynamicMethodPropertySetterStrategy.PreBuildUp(IBuilderContext context)
                      at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
                 InnerException:

Coordinator
May 10, 2011 at 1:11 AM

Compile the executable as x86 rather than Any CPU. This is needed due to one of the dependencies but will eventually go away.

May 10, 2011 at 1:23 AM

Thanks for the quick reply Josh, and it works.

Cheers,

Jeff