As I've been doing some work on removal of the UserSettings and RecentFiles services, I have noticed a problem with the API. When a user requests a service by calling GetService we return null if the service is not available. This was intended to allow flexibility when a particular service is not available. However, I find that it can lead to a lot of debugging when the return value is simply saved and the caller tries to use it at a later time.
Maybe for V4 we should throw an exception in this situation and supply a TryGetService method for those who deliberately choose the flexibility.
The interface we would have to change is IServiceLocator
As I've been doing some work on removal of the UserSettings and RecentFiles services, I have noticed a problem with the API. When a user requests a service by calling GetService we return null if the service is not available. This was intended to allow flexibility when a particular service is not available. However, I find that it can lead to a lot of debugging when the return value is simply saved and the caller tries to use it at a later time.
Maybe for V4 we should throw an exception in this situation and supply a TryGetService method for those who deliberately choose the flexibility.
The interface we would have to change is
IServiceLocator