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

[Issue] Launching SDV Mod Manager before ever running Stardew Valley results in Unhandled Exception #18

Closed
RyanWalpole opened this issue Mar 8, 2022 · 3 comments
Assignees
Labels
status: requires documentation Requires Improvements or additions to documentation type: critical bug A critical bug that can make the application unstable to use.

Comments

@RyanWalpole
Copy link
Collaborator

Describe the Issue
Stardew Valley Mod Manager will return an Unhandled Exception after the initial application setup if Stardew Valley has never been run on the system (even if Stardew Valley and SMAPI are installed)

Unhandled exception has occurred in your application. 
If you click Continue, the application will ignore this error and attempt to continue. 
If you click Quit, the application will close immediately.

Could not find a part of the path
'C:\Users\user\AppData\Roaming\StardewValley\Saves'

Steps to Replicate
Steps to reproduce the behavior:

  1. Have Stardew Valley and SMAPI installed on your system, but have not ever run Stardew Valley.
  2. Open the Mod Manager (and complete setup for the Mod Manager)
  3. Witness error

Expected behavior
For the application to launch without an unhandled exception, for the exception to be handled in code.

Screenshots
image

Environment:

  • Windows Version: Windows 11
  • Mod Manager Version: v220302

Suggested Resolution
Handle the exception at Form.Load. Currently the application assumes that the user has run Stardew Valley before and therefore the Game Save Management tab attempts to load all directories in the AppData\StardewValley\Saves\ folder. Simply put a catch statement to catch the Exception and present a MessageBox:

MessageBox.Show(
"We weren't able to find your Game Saves folder. This usually happens if you've never run 
Stardew Valley before. If you're on a new PC, consider checking if your 
Game Save files were successfully moved.",
"Game Save Management | Stardew Valley Modded Framework", 
MessageBoxButtons.OK, MessageBoxIcon.Warning)

//Unsure of actual name of button, but probably should
//disable the button that opens the game save directory since it doesn't exist.
ViewSaveFilesButton.Enabled = False;
@RyanWalpole RyanWalpole added status: needs triage Requires assessment to determine severity, impact and to collect more data on the issue. version: 220302 labels Mar 8, 2022
@RyanWalpole RyanWalpole added this to To do in Dev: SDVMM v220303 Mar 8, 2022
@RWELabs RWELabs added the type: critical bug A critical bug that can make the application unstable to use. label Mar 8, 2022
RWELabs added a commit that referenced this issue Mar 9, 2022
[Issue #18] Re-route application to splash screen on launch instead of main dashboard

Co-Authored-By: Ryan Walpole <69621127+RyanWalpole@users.noreply.github.com>
RWELabs added a commit that referenced this issue Mar 9, 2022
[Issue #18] Create splash screen form that aims to solve issue #18 - adds code to check for the folders and create them if they're not available.

Co-Authored-By: Ryan Walpole <69621127+RyanWalpole@users.noreply.github.com>
@RyanWalpole
Copy link
Collaborator Author

Have uploaded commit, adding a new "Splash" screen that programmatically checks for the folders that are required and creates them if they haven't already been created.

private void CheckDirectory_Tick(object sender, EventArgs e)
        {
            CheckDirectory.Stop();
            Status.Text = "Validating Directories...";

            CreateDirectories();

            LaunchApplication.Start();
        }
private void CreateDirectories()
        {
            //Check for Mods Directory
            string ModsDirectory = Properties.Settings.Default.StardewDir + @"\Mods";
            if (!Directory.Exists(ModsDirectory))
            {
                Directory.CreateDirectory(ModsDirectory);
            }

            //Check for Inactive Mods Directory
            string InactiveModsDirectory = Properties.Settings.Default.StardewDir + @"\inactive-mods";
            if (!Directory.Exists(InactiveModsDirectory))
            {
                Directory.CreateDirectory(InactiveModsDirectory);
            }

            //Check for Presets Directory
            string PresetsDirectory = Properties.Settings.Default.StardewDir + @"\mod-presets";
            if (!Directory.Exists(PresetsDirectory))
            {
                Directory.CreateDirectory(PresetsDirectory);
            }

            //Check for Saves Directory
            string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string sdvsaves = appdata + @"\StardewValley\Saves\";
            if (!Directory.Exists(sdvsaves))
            {
                Directory.CreateDirectory(sdvsaves);
            }

            //Check for Save Backups Directory
            string backupsdir = Properties.Settings.Default.StardewDir + @"\savebackups\";
            if (!Directory.Exists(backupsdir))
            {
                Directory.CreateDirectory(backupsdir);
            }
        }

@RyanWalpole RyanWalpole moved this from To do to In progress in Dev: SDVMM v220303 Mar 9, 2022
RWELabs added a commit that referenced this issue Mar 9, 2022
Implement Application.Exit(); for the FormClosing event of the FirstRunSetup-Complete.cs window. Also forwarded the user to Splash.cs instead of main page to ensure no issues from #18 arise.

Co-Authored-By: Ryan Walpole <69621127+RyanWalpole@users.noreply.github.com>
@RWELabs RWELabs added status: requires documentation Requires Improvements or additions to documentation and removed status: needs triage Requires assessment to determine severity, impact and to collect more data on the issue. labels Mar 9, 2022
@RyanWalpole
Copy link
Collaborator Author

RyanWalpole commented Mar 9, 2022

@RyanWalpole RyanWalpole added this to the v220303_Stable milestone Mar 9, 2022
@RyanWalpole RyanWalpole moved this from In progress to Done in Dev: SDVMM v220303 Mar 10, 2022
@RyanWalpole RyanWalpole moved this from Done to In Testing (release-alpha) in Dev: SDVMM v220303 Mar 10, 2022
@RyanWalpole RyanWalpole moved this from In Testing (release-alpha) to Done in Dev: SDVMM v220303 Mar 10, 2022
@RyanWalpole
Copy link
Collaborator Author

Issue has been resolved in release build 220303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: requires documentation Requires Improvements or additions to documentation type: critical bug A critical bug that can make the application unstable to use.
Projects
Development

No branches or pull requests

2 participants