lbugnion / mvvmlight

The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Windows 10 UWP, Windows Presentation Foundation (WPF), Silverlight, Windows Phone.
http://www.mvvmlight.net
MIT License
1.16k stars 311 forks source link

SimpleIoc is no longer inherited from IServiceLocator in Std10 version. #91

Open manupstairs opened 4 years ago

manupstairs commented 4 years ago

Hi, I have a question about SimpleIoc. Why is SimpleIoc no longer inherited from IServiceLocator in Std10 version? This will cause compatibility issues with ServiceLocator.

I checked the code, seems we don't need CommonServiceLocator any more. We can use the SimpleIoc directly.

I'm just curious why we needed CommonServiceLocator before. Could you please help to explain?

I would appreciate it if you could help answer this question. Thanks.

jamesmcroft commented 3 years ago

@manupstairs at the time that MvvmLight was ported to .NET standard, the CommonServiceLocator didn't support .NET Standard so was removed.

tjmullen2 commented 3 years ago

By removing compatibility with CommonServiceLocator, unit testing through Moq to return our mocks in case of GetInstance is now not possible. We used to be able to mock the GetInstance<> returns via CommonServiceLocator. Is there any word on when this functionality will be changed back? Or do you have suggestions on how to do this with the current implementation?