Calling IoC.Get() from a ViewModel, throws the following exception: "No parameterless constructor defined for type 'Setup.Maui.Services.IService".
Steps to reproduce:
Change Setup.Maui project file to use 8.0.92
Remove assembly references to local Caliburn.Micro.Maui dll.
Caliburn.Micro.Maui package, version 5.0.151-beta from Nuget
Add the following code to the MainViewModel class:
private IService _theService;
public void OnCounterClicked()
{
_theService = IoC.Get<IService>();
count++;
}
If I call IoC.Get() it works. However, normally I can use the interface to get the Service (at least I could in XF).
I've tried to configure the IService with container.RegisterPerRequest (as in the sample) but also I tried:
container.PerRequest<IService, MyService>();
contain.Singleton<IService, MyService>():
All these produce the same error.
Is this functioning as designed for Maui?