I have a controller class that takes care for the double click command and in turn calls a method that popups a window to the user. Something like :
var popup = container.GetService<PopupCommand>();
In the above line it throws an error saying : The current type, PopupCommand.IPopupDataHandler, is an interface and cannot be constructed. Are you missing a type mapping?
I updated the DLL that contained a method for container.GetService(), before that it used to work fine.
I tried searching in google, but the issues similar are more related to Unity, and i doubt whether my issue is anywhere related to Unity.
Basically the compiler tells you that you are trying to instantiate an interface.
container.GetService<PopupCommand>()
probably brings you back an interface named PopupCommand.IPopupDataHandler
, you probably need to cast it to the type you need or change the type to an object, you should also check the constrains of the method - it could be missing the new
constraint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With