Could not load type 'INotifyPropertyChanging' error in VS 2012 Premium with MvvmLight 4.1.24.0

Oct 31, 2012 at 2:58 PM

After installing 4.1.24.0, I am getting this error every time I open a XAML file:

Could not load type 'System.ComponentModel.INotifyPropertyChanging' from assembly 'mscorlib.extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. 

The error originates in App.xaml, on the line: <vm:ViewModelLocation x:Key="Locator" d:IsDataSource="True" />

My project was a VS Express 2010 targetted for WP7.1. I didn't have this error when using MvvmLight 4.0.23.4 in VS Express 2010.

Coordinator
Oct 31, 2012 at 3:40 PM
Thanks for your message, I thought this was fixed but I will check it out asap.

Cheers
Laurent

Sent from my Nokia Lumia 900

From: azgolfer
Sent: 10/31/2012 7:59
To: laurent@galasoft.ch
Subject: Could not load type 'INotifyPropertyChanging' error in VS 2012Premium with MvvmLight 4.1.24.0 [mvvmlight:401430]

From: azgolfer

After installing 4.1.24.0, I am getting this error every time I open a XAML file:

Could not load type 'System.ComponentModel.INotifyPropertyChanging' from assembly 'mscorlib.extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

The error originates in App.xaml, on the line: <vm:ViewModelLocation x:Key="Locator" d:IsDataSource="True" />

My project was a VS Express 2010 targetted for WP7.1. I didn't have this error when using MvvmLight 4.0.23.4 in VS Express 2010.

Nov 1, 2012 at 1:47 PM

Same here, I had to revert to my custom build of MVVM Light where I have removed all references to mscorlib.extensions

The applicaiton works fine, but design mode in VS2012 or Blend throws this:

TypeLoadException: Could not load type 'System.ComponentModel.INotifyPropertyChanging' from assembly 'mscorlib.extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

Stacktrace:

at xyz.Services.ViewModelLocator..cctor()

Nov 1, 2012 at 6:32 PM

I have the same issue in the  VS Express 2012 targeted for WP7.1..

Nov 3, 2012 at 2:40 AM

Just started using this library and ended up with this error, is there a quick fix from my end or I have to wait on an update?

Nov 3, 2012 at 4:50 AM

I had this same error.  It seems (at least I am guessing) that the error is coming from using ViewModelBase.IsInDesignModeStatic in the ViewModelLocator to decide when to load design time data.

Using the built in property helped solve the issue for me.

DesignerProperties

.IsInDesignTool;This may vary by platform, but each platform has this

Nov 4, 2012 at 7:02 PM

Same issue for me.  I should have checked the forums first instead of looking for a problem I created. Not a big deal for me though yet.

Coordinator
Nov 4, 2012 at 9:03 PM

Hey guys,

I am working on this issue, unfortunately it seems to be an issue in the WP8 framework. I will talk to the WP8 team (and the Blend team...) and try to find a solution ASAP. I don't have a workaround right now unfortunately.

Thanks for your patience,.

Laurent

Nov 6, 2012 at 12:01 AM

The problem here. I tried going back to version 4.0.23 but the problem persists, any workarounds? AlfredoRod's solution did not work for me :/ Oh and beside the UI XAML Designer crashing I also lost intellisence in xaml

Nov 6, 2012 at 2:55 AM
Edited Nov 6, 2012 at 2:56 AM
AlfredoRod wrote:

I had this same error.  It seems (at least I am guessing) that the error is coming from using ViewModelBase.IsInDesignModeStatic in the ViewModelLocator to decide when to load design time data.

Using the built in property helped solve the issue for me.

 

DesignerProperties

.IsInDesignTool;This may vary by platform, but each platform has this

 

I did this on my WP8 Project. 

Alternatively, this also worked for me. You could just comment out any non-design type injections and use only the blend ones. This is fine if all you are doing is working in blend at the moment.

IE:

 

              //if (ViewModelBase.IsInDesignModeStatic)
            //{
                if (!SimpleIoc.Default.IsRegistered<IDataService>())
                {
                    SimpleIoc.Default.Register<IDataService, DesignDataService.DesignDataService>();
                }
		SimpleIoc.Default.Register<INavigationService, DesignNavigationService>();
            //}
            //else
            //{
            //    SimpleIoc.Default.Register<IDataService, DataService>();
            //    SimpleIoc.Default.Register<INavigationService, NavigationService>();
            //}

 

 

I also then commented out any VM's that inherited from ViewModelBase or referenced it in any way.

 

public class SampleViewModel //: ViewModelBase

 

This was enough to get it up and running in Blend. 

When you want to run the application simply put back everything you commented out. A bit crude but it's enough to see what you need in the designer.

Nov 8, 2012 at 8:53 AM
Edited Nov 8, 2012 at 10:57 AM

Any news ?

I have the same issue in Expression Blend 5 (included in Visual Studio 2012) in WP7.1 project. 

Is there any temporary solution? I can not continue to create a business project.

Nov 8, 2012 at 11:56 AM

What I eventually did was download the source, remove Reference to mscrolib.extensions, remove INotifyPropertyChanging (and everything related) from the source code, build a use in my project. Works like a charm

Nov 8, 2012 at 12:33 PM

Thx, It works ;-)

Coordinator
Nov 11, 2012 at 9:59 PM

Please find a quick fix in the following blog post:

http://blog.galasoft.ch/archive/2012/11/11/a-fix-for-the-design-time-error-in-mvvm-light.aspx

A proper installer will follow ASAP, probably next week.

Cheers

Laurent

Nov 12, 2012 at 7:44 AM

Is it also fixed when working with WP7 projects in VS2012? Actually I had no issues when working with WP8 projects.

Nov 12, 2012 at 5:31 PM

This fix is for WP8 project only, as it seems, right ?

I, too, have this error in VS2012 with a WP7.1 project previously created in VS2010, and when i try to apply the fix i have an error while referencing the new DLLs : "A reference to a higher version or incompatible assembly cannot be added to the project"

Coordinator
Nov 12, 2012 at 5:44 PM

Working on the same fix for WP7.1. Stay tuned, sorry for the delay.

Coordinator
Nov 13, 2012 at 8:15 PM

Hi,

Please try these DLLs and give me feedback. Thanks!

http://sdrv.ms/QbsiGp

Laurent

Nov 13, 2012 at 8:42 PM

I've found something in your skydrive named MVVMLight_V4_1_25_WP71.zip.

But it didn't work for me in my wp71 project.

Coordinator
Nov 13, 2012 at 9:25 PM

Hi,

Can you give more details? What didn't work?

Thanks
Laurent

Nov 13, 2012 at 10:48 PM
Edited Nov 13, 2012 at 11:02 PM

Hi Laurent, sadly your link http://sdrv.ms/QbsiGp looks exactly the same as sunday one. Same dlls targeting WP8 (instead of WP7.1, i guess). Not sure if it was expected or not. Anyway, I've got exact same issue :-)  

Wrong link ?

EDIT : ok found the MVVMLight_V4_1_25_WP71.zip file in your public skydrive files... now I can reference all dlls with no error. But it does not fix anything. Same issue in VS2012 and Blend : Error 2 Could not load type 'System.ComponentModel.INotifyPropertyChanging' from assembly 'mscorlib.extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'...

Nov 14, 2012 at 7:29 AM

That's exactly what i mean.

 

Then I download the source code and remove all the NotifyPropertyChanging & RaisePropertyChanging in ViewModelBase and ObservableObject.

Then compile it, and reference it in my wp71 project with the IDE in wp8 sdk, then it works....

Coordinator
Nov 14, 2012 at 7:49 AM

OK I will check it out again. Who else hates strong named DLLs? I sure do... (talking about Sys.Windows.Interactivity here)

Dec 11, 2012 at 5:01 AM

Was there ever a solution to this? Having this exact issue whether it's from NuGet, CodePlex, etc. Tried the file from your SkyDrive already and still getting the same error.

 

Coordinator
Dec 11, 2012 at 7:34 AM

Hi,

At this point I am very annoyed to say that I wasn't able to fix the issue in WP7 DLLs. It is fixed in the WP8 DLLs, but WP7 doesn't accept my changes for some reason. I will invest more time into this today and if needed I will involve Microsoft.

Sorry for the delay in resolving the matter, this is quite painful for me too :(

Laurent

Dec 11, 2012 at 9:32 AM

Hello Laurent,

Can you tell me how did you fixed it on WP8?
I've  downloaded the source code and I'm trying to help fix this error too.

Best regards,

Henrique 

Dec 11, 2012 at 9:50 AM

Hello Henrique,

I did get mvvm light working on WP7 by deleting all references to INotifyPropertyChanging as BezySoft suggested in his post on the November the 8th.
For my current projects this is fine, as I don't need it anyway.

However, this is still just a quick fix circumventing the real problem. At this point i'm really curious how to fix the DLL naming issue.

David

Dec 11, 2012 at 10:51 AM

The updated dlls do work for wp8.  

Although there are  errors with relay commands in xmal.  Even though they are showing as actual errors, the project compiles and the commands work as expected.  

Coordinator
Dec 11, 2012 at 11:30 AM

Henrique,

This is not a code issue, but an invalid reference caused by System.Windows.Interactivity.dll. This DLL is strongly named, so every time that there is a new version I need to rebuild MVVM Light unfortunately.

In Windows Phone 8, I replaced the DLL with the newest one, rebuilt and the error was fixed. In Windows Phone 7.1 however this didn't work.

I wrote to my friends on the Blend team and hopefully we'll hear from them soon (crossing fingers).

Cheers

Laurent

Dec 11, 2012 at 12:06 PM
Edited Dec 11, 2012 at 12:21 PM

EDIT: Forget it. The error reappears after deploying the application. 

Can someone try to reproduce these steps and tell me if works?

  1. Download the MVVMLight source code and extract it
  2. Remove the MVVMLight references from your project (you can keep Microsoft.Practices.ServiceLocation and System.Windows.Interactivity)
  3. Add GalaSoft.MvvmLight (WP71).csproj project to your solution
  4. Add GalaSoft.MvvmLight.Extras (WP71).csproj project to your solution
  5. Add a reference to these projects to your project
  6. Clean the solution
  7. Build the solution

It's hard to believe, but here the error disappears. I didn't need to comment INotifyPropertyChanging or remove mscorlib.extensions.

Coordinator
Dec 11, 2012 at 12:21 PM

Rick, just tried that but it didn't solve the issue for me.

Wondering, how many people actually use the PropertyChanging event in WP7.1. Should I just remove it for that framework? I hate to have to remove features in one or the other framework, but... 

Laurent

Dec 11, 2012 at 1:49 PM
lbugnion wrote:

Rick, just tried that but it didn't solve the issue for me.

Wondering, how many people actually use the PropertyChanging event in WP7.1. Should I just remove it for that framework? I hate to have to remove features in one or the other framework, but... 

Laurent

I edited my post.

After deploying for the first time, the error reappears. ( I was so pissed off... =] )

At least you could build it once? If no, I can make a screen record for you.

About usage of PropertyChanging, I never used it on my projects. Maybe you could remove it only for WP7 until Microsoft find what is happening...

Best regards!

Henrique

Dec 11, 2012 at 5:14 PM

Hi Laurent,

Thanks for your response! I'd just like to thank you for this incredibly useful toolkit.

 

Personally, I don't need INotifyPropertyChanging -- I've been developing a business solution using the WP7.0 solution for a year or so, and so I've never become dependent on it yet ;) 

 

I'm currently developing a new PCL targeting WP7.5, and Windows Store -- my intention is to share the ViewModel logic (almost) completely, and not use INotifyPropertyChanging (I personally don't understand the use-case)

 

Thanks again!

Dec 12, 2012 at 10:29 AM

Hi Laurent,

I am also having this same issue when editing windows 7.1 projects in VS 2012.

In reference to your question "Wondering, how many people actually use the PropertyChanging event in WP7.1".  Not as part of my use of MVVM Light so if you did remove it, it would not affect my projects.

On a side note.  Thanks for all your work on a great toolkit.  Until I found MVVM Light I was struggling with MVVM implementation, but now thanks to your toolkit and your video presentations it now makes sense.

Thanks

Bevan

Dec 12, 2012 at 12:25 PM
EliteMikeS wrote:

The updated dlls do work for wp8.  

Although there are  errors with relay commands in xmal.  Even though they are showing as actual errors, the project compiles and the commands work as expected.  

I realized that I did not replace the interactivity dll, once I did that the .25 build works just fine. 

Coordinator
Dec 12, 2012 at 12:27 PM

Thanks for following up, Mike. I am happy it works now.

Cheers
Laurent 

Coordinator
Dec 16, 2012 at 8:48 PM

For WP7.1, please try the DLLs here:

http://sdrv.ms/UUyOfU

I temporarily removed the INotifyPropertyChanging interface implementation from Windows Phone 7.1. All the other frameworks are unchanged. In parallel, I have asked my friends from the Expression Blend team to look at the issue. Hopefully we can restore the full functionality soon.

I will publish these DLLs to the MSI installer and NuGet in the next few days.

Cheers,
Laurent 

Dec 18, 2012 at 8:38 AM

Thanks, that really helps a lot :)

Cheers,
Serge

 

 

Dec 18, 2012 at 3:57 PM

Hi Laurent,

I *think* this is working again!

I had a bunch of issues with the MVVMLight PCL in addition to this project, but it seems to have fixed itself - one of those files that only gets deleted on the 50th 'clean', I guess.

 

 

Thanks!

Jan 26, 2013 at 9:52 AM

Hi Laurent,

I am on VS2012, Blend2012 and WP7 and getting the same error. I got the latest MVVMLight version (4.1.26.1) via Nuget.

Do I need to install via the MSI - is there any magic that nuget can't provide?

Thanks heaps!

Coordinator
Jan 27, 2013 at 8:34 AM

Hi Steve,

Here is what I just tested, and it worked:

  • Create a new WP7.1 app in VS12
  • Using Nuget (from VS12), add MVVM Light full version
  • In MainPage.xaml, use Blend to bind the MainPage DataContext to the Main property of the ViewModelLocator.
  • Add a RelayCommand to the MainViewModel. This command just shows a message box.
  • Add an EventToCommand to the title panel of the MainPage and bind its Command to the RelayCommand in the MainViewModel. This was done in Blend 12
  • Execute the app and test, it works.

I also checked the version number and it is V4.1.26.1 from Nuget instead. GalaSoft.MvvmLight.Extras.WP71.dll version is 4.1.26.29817.

Can you also check the version of System.Windows.Interactivity.dll? It should be 2.0.30816.0 (or larger).

Let me know,

Thanks
Laurent 

Jan 29, 2013 at 10:48 AM

Hi Laurent,

 

Thanks for your reply.

My problem persists and is actually pretty good explained by the first post in this thread.

The version numbers are exactly the same as you have:

GalaSoft.MvvmLight.Extras.WP71.dll is 4.1.26.29817

System.Windows.Interactivity.dll is 2.0.30816.0

 

I'll set up a new solution with exactly the same steps as you did and see if that works on my machine!


Thanks heaps!

Steve

Feb 7, 2013 at 6:41 AM
Hi Laurent,

You are right. With a new app, it works great and I don't see any problems. I'll go ahead and delete some components of my app and see when the problem vanishes away and go from there.
Thanks for the great framework, by the way and great community support!

Steve
Feb 26, 2013 at 12:50 PM
Hi Laurent,

Thanks for the fix for Wp8 mvvm light.. works very well. Love the framework btw keep up the good work
Cheers
Scott
May 17, 2013 at 3:55 PM
Laurent,

From the thread it sounds like this problem had been patched up by now. I installed MMVM light via nuget a few days ago, For instance System.Windows.Interactivity Verion 3.8.5.0 and still get this error.

I don't use blend. It shows up in the Designer in VS2012 Express for WP

Anything we can do?

Thanks
Coordinator
May 17, 2013 at 4:16 PM
Hi,

You need to make sure that you are using the latest version of VS (update 2).

The VS designer *is* Blend so you are in fact using it ;)

Cheers
Laurent
--
Laurent Bugnion
Senior Director, IdentityMine
Microsoft Regional Director and MVP
http://www.galasoft.ch | http://www.identitymine.com
Sent from my beautiful Nokia Lumia 920

From: [email removed]
Sent: ‎17.‎05.‎2013 17:56
To: [email removed]
Subject: Re: Could not load type 'INotifyPropertyChanging' error in VS 2012Premium with MvvmLight 4.1.24.0 [mvvmlight:401430]

From: Familyghost

Laurent,

From the thread it sounds like this problem had been patched up by now. I installed MMVM light via nuget a few days ago, For instance System.Windows.Interactivity Verion 3.8.5.0 and still get this error.

I don't use blend. It shows up in the Designer in VS2012 Express for WP

Anything we can do?

Thanks
May 17, 2013 at 4:20 PM
This is update 2, VS 11.0.60315.01
.NET framework 1.5.50709
Sent from Windows Mail
From: lbugnion
Sent: ‎Friday‎, ‎May‎ ‎17‎, ‎2013 ‎11‎:‎16‎ ‎AM
To: [email removed]

From: lbugnion

Hi,

You need to make sure that you are using the latest version of VS (update 2).

The VS designer *is* Blend so you are in fact using it ;)

Cheers
Laurent
--
Laurent Bugnion
Senior Director, IdentityMine
Microsoft Regional Director and MVP
http://www.galasoft.ch | http://www.identitymine.com
Sent from my beautiful Nokia Lumia 920

From: [email removed]
Sent: ‎17.‎05.‎2013 17:56
To: [email removed]
Subject: Re: Could not load type 'INotifyPropertyChanging' error in VS 2012Premium with MvvmLight 4.1.24.0 [mvvmlight:401430]

From: Familyghost

Laurent,

From the thread it sounds like this problem had been patched up by now. I installed MMVM light via nuget a few days ago, For instance System.Windows.Interactivity Verion 3.8.5.0 and still get this error.

I don't use blend. It shows up in the Designer in VS2012 Express for WP

Anything we can do?

Thanks
Coordinator
May 17, 2013 at 5:54 PM
I'll check it out.

Cheers
Laurent
--
Laurent Bugnion
Senior Director, IdentityMine
Microsoft Regional Director and MVP
http://www.galasoft.ch | http://www.identitymine.com
Sent from my beautiful Nokia Lumia 920

From: [email removed]
Sent: ‎17.‎05.‎2013 18:20
To: [email removed]
Subject: Re: Could not load type 'INotifyPropertyChanging' error in VS 2012Premium with MvvmLight 4.1.24.0 [mvvmlight:401430]

From: Familyghost

This is update 2, VS 11.0.60315.01
.NET framework 1.5.50709
Sent from Windows Mail
From: lbugnion
Sent: ‎Friday‎, ‎May‎ ‎17‎, ‎2013 ‎11‎:‎16‎ ‎AM
To: [email removed]

From: lbugnion

Hi,

You need to make sure that you are using the latest version of VS (update 2).

The VS designer *is* Blend so you are in fact using it ;)

Cheers
Laurent
--
Laurent Bugnion
Senior Director, IdentityMine
Microsoft Regional Director and MVP
http://www.galasoft.ch | http://www.identitymine.com
Sent from my beautiful Nokia Lumia 920

From: [email removed]
Sent: ‎17.‎05.‎2013 17:56
To: [email removed]
Subject: Re: Could not load type 'INotifyPropertyChanging' error in VS 2012Premium with MvvmLight 4.1.24.0 [mvvmlight:401430]

From: Familyghost

Laurent,

From the thread it sounds like this problem had been patched up by now. I installed MMVM light via nuget a few days ago, For instance System.Windows.Interactivity Verion 3.8.5.0 and still get this error.

I don't use blend. It shows up in the Designer in VS2012 Express for WP

Anything we can do?

Thanks
Coordinator
May 19, 2013 at 1:21 PM

Hi,

I don’t see the error. I tried adding mvvmlight through Nuget in a Windows Phone 7.1 and in a Windows Phone 8 app and both times I was able to wire the VM, add a property, and see everything in the VS designer.

Can you send me the app you did, including the packages folder with the downloaded DLLs?

Thanks

Laurent

May 19, 2013 at 6:13 PM
Sure thing Laurent, see attached.
I find I have to compile and run in more than once to see the error in the designer window.
Maybe you can tell me why my listbox data isn’t binding. I’m out of ideas.
Thanks,
Chris