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

[Bug]: appsettings.Development.json is not found #99

Closed
1 task done
Strypper opened this issue Feb 14, 2023 · 0 comments · Fixed by #100
Closed
1 task done

[Bug]: appsettings.Development.json is not found #99

Strypper opened this issue Feb 14, 2023 · 0 comments · Fixed by #100
Assignees
Labels
bug 🐛 Something isn't working level/difficult 😐
Milestone

Comments

@Strypper
Copy link
Owner

Contact Details

ocgrb.strypperjason115@gmail.com

What happened?

image

In the new version of MAUIsland we include provide it the way to grab the application settings file to get all the settings it need to startup the application, and later for future user settings storage

The problem right now is that we can't get the file with this line of code

using var stream = assembly.GetManifestResourceStream("MAUIsland.appsettings.Development.json");

Detail implementation in MauiProgram

    static MauiAppBuilder GetAppSettings(this MauiAppBuilder builder)
    {
        var assembly = Assembly.GetExecutingAssembly();
        using var stream = assembly.GetManifestResourceStream("MAUIsland.appsettings.Development.json");

        if (stream is not null)
        {
            var config = new ConfigurationBuilder()
                        .AddJsonStream(stream)
                        .Build();

            builder.Configuration.AddConfiguration(config);
        }
        else
        {
            var options = new SnackbarOptions
            {
                BackgroundColor = AppColors.Purple,
                TextColor = AppColors.White,
                ActionButtonTextColor = AppColors.Pink,
                CornerRadius = new CornerRadius(Dimensions.ButtonCornerRadius),
                CharacterSpacing = 0.5
            };
            var message = "Can't find app settings file";

            var snackbar = Snackbar.Make(message, null, "OK", TimeSpan.FromSeconds(5), options);
            snackbar.Show();
        }

Version

7.0

What platforms are you seeing the problem on?

Android, Windows, MacOS, IOS

Relevant log output

None

Code of Conduct

  • I agree to respect and follow this project's rules
@Strypper Strypper added bug 🐛 Something isn't working level/difficult 😐 labels Feb 14, 2023
@Strypper Strypper added this to the Release 1.0 milestone Feb 14, 2023
@Strypper Strypper linked a pull request Feb 15, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working level/difficult 😐
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants