Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentNullException: Value cannot be null. (Parameter 'stream') #3300

Open
sachinthau opened this issue Jan 10, 2025 · 0 comments
Open

Comments

@sachinthau
Copy link

sachinthau commented Jan 10, 2025

Description

I have migrated my existing Prism application from Xamarin to MAUI, but I am encountering a runtime error that causes the app to get stuck during loading.

Steps to Reproduce

The application has been migrated to .NET 8 MAUI, and these are the plugins I added via NuGet for Prism:

<PackageReference Include="Prism.DryIoc.Maui" Version="9.0.537" />
<PackageReference Include="Prism.Maui" Version="9.0.537" />

My MauiProgram.cs looks like below

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder()
            .UseMauiCommunityToolkit()
            .UseMauiApp<App>()
            .UsePrism(prism => prism.RegisterTypes(container =>
            {
                RegisterServicesPages(container);
            }))
            .UseCardsView()
            .UseSkiaSharp()
            .UseMauiRGPopup()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
            });

        builder.Services.AddSingleton<ILoadingPageService, LoadingPageService>();

        // Register platform-specific services
#if ANDROID
        builder.Services.AddSingleton<IDeviceService, TeBSMobile.Platforms.Android.DeviceService>();
#elif IOS
        builder.Services.AddSingleton<IDeviceService, TeBSMobile.Platforms.iOS.DeviceService>();
#endif

        return builder.Build();
	}

    public static void RegisterServicesPages(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterForNavigation<CustomNavigationPage>();
        containerRegistry.RegisterForNavigation<SplashScreenPage, SplashScreenPageModel>();
        containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>();
        containerRegistry.RegisterForNavigation<LoginPage, LoginPageModel>();
        containerRegistry.RegisterForNavigation<QuickGuidePage, QuickGuidePageModel>();
    }
}

Platform with bug

.NET MAUI

Affected platforms

Android

Did you find any workaround?

No response

Relevant log output

System.ArgumentNullException: Value cannot be null. (Parameter 'stream')
  at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry`1 itemRef, Object& result) in /_/src/DryIoc/Container.cs:3110
  at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request) in /_/src/DryIoc/Container.cs:11136
  at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:11055
  at DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved) in /_/src/DryIoc/Container.cs:426
  at DryIoc.Container.System.IServiceProvider.GetService(Type serviceType) in /_/src/DryIoc/Container.cs:344
  at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) in /_/src/Core/src/MauiContext.cs:72
  at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) in /_/src/Core/src/MauiContext.cs:72
  at at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
  at at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider provider)
  at Microsoft.Maui.MauiApplication.OnCreate() in /_/src/Core/src/Platform/Android/MauiApplication.cs:46
  at Android.App.Application.n_OnCreate(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.App.Application.cs:1087
  at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant