MAUI RC1 (VS2022 17.2.0 Preview 3.0): StackOverflow caused by recursion in PrismServiceProviderFactory.cs
UweReisewitz opened this issue · comments
UweReisewitz commented
Hi,
this is what I have tested so far:
- Install VS 2022 Version 17.2.0 Preview 3.0 (I have updated from the previous Preview)
- Clone Master Branch
- Update all NuGet packages
- Remove unnecessary entries from project file PrismMauiDemo.cs:
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.2" />
</ItemGroup>
- Remove line 49 in Prism.Maui\sample\PrismMauiDemo\Platforms\Windows\Package.appxmanifest:
<uap:SplashScreen Image="Assets\appiconfgSplashScreen.png" />
- Rebuild Solution
- Run PrismMauiDemo
- The first problem is in Prism.Maui\src\Prism.Maui\Modularity\ModuleManager.cs
- LoadModules crashes with:
DryIoc.ContainerException: 'code: Error.RegisteringImplementationNotAssignableToServiceType;
message: Registering implementation type MauiModule.ViewModels.ViewAViewModel is not assignable to service type MauiModule.Views.ViewA.'
- Solution: See #6 (comment)
- The application now crashes with a stackoverflow in Prism.Maui\src\Prism.Maui\Ioc\PrismServiceProviderFactory.cs:
internal class ServiceScopeFactory : IServiceScopeFactory
{
private IServiceProvider _services { get; }
public ServiceScopeFactory(IServiceProvider services)
{
_services = services;
}
public IServiceScope CreateScope()
{
return _services.CreateScope();
}
}
- Reason:
return _services.CreateScope()
creates a new ServiceScopeFactory which causes the recursion
Now I'm stuck. If I could be of any help please let me know.
Best Regards
Uwe
Dan Siegel commented
Resolved by #18