MVVM Light Toolkit doesn't work on WP 7.1 project in VS 2012 Express

Jan 7, 2013 at 1:26 AM
Edited Jan 7, 2013 at 1:27 AM

Just want to let developer know that the latest version (4.1.26) of MVVM Light Toolkit won't work on WP 7.1 project in VS 2012. Tried to install toolkit from NuGet, and did some control command bindings, everything worked fine when using WP8 emulator. But when deployed on my WP7 device, none of command binding worked.

Jan 8, 2013 at 2:29 PM

Me too, I just updated from 4.0.23 to 4.1.26 and my WP71 app just blown up together with blend and visual studio design preview window.
I have plenty of errors of any kind, selling them on 50% sale if anyone is interested :)

I am in a dead end because I updated to fix the "System.ComponentModel.INotifyPropertyChanging" bug in blend but I found myself with other things like the design preview in VS12 not working and crashing as soon as I breathe.

Sometimes I get

System.Runtime.Remoting.RemotingException

[3484] Designer process terminated unexpectedly!

 

other times

Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteExceptionCould not load file or assembly 'LocationService.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e' or one of its dependencies. The system cannot find the file specified.at System.Device.Location.GeoCoordinateWatcher.Dispose(Boolean disposing)at System.Device.Location.GeoCoordinateWatcher.Finalize()

 

or StackTrace as

at [projectname].Views.LogoToMaskColor.Convert(Object value, Type targetType, Object parameter, CultureInfo culture)at System.Windows.Data.BindingExpression.ConvertToTarget(Object value)at System.Windows.Data.BindingExpression.GetValue(DependencyObject d, DependencyProperty dp)at System.Windows.DependencyObject.EvaluateExpression(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry)at System.Windows.DependencyObject.EvaluateBaseValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)at System.Windows.DependencyObject.EvaluateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, ValueOperation operation)at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)at System.Windows.Data.BindingExpression.SendDataToTarget()at System.Windows.Data.BindingExpression.SourceAcquired()at System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender, DataContextChangedEventArgs e)at System.Windows.Data.BindingExpression.DataContextChanged(Object sender, DataContextChangedEventArgs e)at System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)at System.Windows.FrameworkElement.OnTreeParentUpdated(DependencyObject newParent, Boolean bIsNewParentAlive)at System.Windows.DependencyObject.UpdateTreeParent(IManagedPeer oldParent, IManagedPeer newParent, Boolean bIsNewParentAlive, Boolean keepReferenceToParent)at MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement, IntPtr parentElement, IntPtr childElement, Byte bIsParentAlive, Byte bKeepReferenceToParent, Byte bCanCreateParent)

 

 

now the "XXXviewModel" does not exist in the "ViewModelNamespace" that was in 4.1.26 propagated from blend to VS12 too and in 4.0.23. yeah.

Jan 8, 2013 at 2:55 PM
Edited Jan 8, 2013 at 2:56 PM

and with 4.0.23 I can't create a new SampleData from class because I get:

Could not load the assembly [appanme] because the following errors occurred:

Could not load type System.ComponentModel.lNotifyPropertyChanging from assembly

. mscorlib.extensions, Version=2,O,5,O, Culture=neutral, PublicKeyToken=7cec85d7bea7798

Could not load type System.ComponentModel.lNotifyPropertyChanging from assembly

. mscorlib.extensions, Version=2,O,5,O, Culture=neutral, PublicKeyToken=7cec85d7bea7798

Could not load type System.ComponentModel.lNotifyPropertyChanging from assembly

. mscorlib.extensions, Version=2,O,5,O, Culture=neutral, PublicKeyToken=7cec85d7bea7798

Could not load type System.ComponentModel.lNotifyPropertyChanging from assembly

. mscorlib.extensions, Version=2,O,5,O, Culture=neutral, PublicKeyToken=7cec85d7bea7798

Could not load type System.ComponentModel.lNotifyPropertyChanging from assembly

. mscorlib.extensions, Version=2,O,5,O, Culture=neutral, PublicKeyToken=7cec85d7bea7798

(as is, repeated 5 times)

Apr 27, 2013 at 5:47 PM
Edited Apr 27, 2013 at 6:16 PM
Hi again,
I solved the Blend crashing and Design Preview window in VS12 not showing prview with the trick described here:
http://stackoverflow.com/questions/15326131/visual-studio-expression-remoteexception
if (!ViewModelBase.IsInDesignModeStatic)
 {
     _watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High) { MovementThreshold = 5 };
 }
I hope it could help and I am curious to know why this happened and why this fixes the problem, I will really appreciate that.

Thanks for MVVM Light!
Apr 29, 2013 at 4:25 AM
There are some things in Windows Phone and WPF apps that require hardware to work correctly. In a designer like Blend, this hardware may not be present. As such, when trying to instantiate those components that communicate directly with the hardware will generally throw errors indicating since the hardware is not available.
Coordinator
Apr 29, 2013 at 4:37 AM
That is correct. In addition to hardware issue, Blend can have issues with asynchronous code (for example when attempting to access web services), thread switching, database access, etc.

In some of my presentations, I show how to attach a Visual Studio debugger to able Blend while it is running your code, and how to execute the code until you find what line is causing the issue. You can then work around the issue with a variety of tricks including avoiding to execute some parts of the code in design mode, and using mocked services to create Blend-safe services.

cheers
Laurent
Apr 29, 2013 at 9:50 AM
Thank you both so much for the explanation.

The thing that keeps bothering me is that I worked with that line of code in designMode for months and it worked flawlessly. Misteries of VS and Blend...