mvvmlight
mvvmlight copied to clipboard
Two different versions of ViewModelLocator?
Hi,
I've noticed, that you provide two different versions of the ViewModelLocator class. In the project template of the Visual Studio extension, there is one with a static constructor. But if you add the mvvmlight nuget package to your project, a class with a public constructor will be created.
The problem with the nuget version is, that the designer may call the public constructor more than once, if you rebuild the project and that results in some "class already registered..." errors. So, you need to add a .reset() call at the beginning of the constructor to fix that. So, I personally prefer the static version.
Is there a reason for that inconsistency and which one is the "correct" one?
Regards, abgenullt
@lbugnion I'd also love to know the answer to this question.