Closed weirdkid closed 3 years ago
I think this is the same issue that I'm seeing. In my case I noticed that the ini settings were not loaded for some of my settings. It turns out that it's only those settings that don't set a default value. Adding a default value, even an empty string, causes the settings to be loaded successfully.
If I use PageFactory.WithInput("id", "name", "");
the setting loads fine. If I use page.WithInput("id", "name");
then the setting does not load. @weirdkid that's a potentially easier work-around for you, in that it doesn't involve modifying the SDK.
Thanks @skiingwiz -- setting a default for all settings fixed the issue for me too.
Environment and System Config
Describe the issue Created a basic hello world plugin with a settings page where I can enter text into a field. Value is saved to ini file but never loaded on subsequent runs. I was able to trace the problem to the LoadSettingsFromIni method where it calls settingsPage.ToValueMap(). The valuemap is never populated. If you get a count of entries in the pageValueMap it's always 0, and I think that's because the valuemap is based on what is in the settingsPage, not what is in the savedSettings. Views are filtered out when they have no value, and of course they have no value before you load the INI.
But, you can get to the values in the saved settings another way. See my workaround below.
Steps to Reproduce Steps to reproduce the behavior: See above.
Expected behavior Values should be populated from the ini file
Screenshots N/A
Logs N/A
Additional info I've worked around the issue by overriding the LoadSettingsFromIni method. I'm not a C# programmer (first time trying to write a plugin too), so there could be things wrong with this that I am not aware of, but it works for me. I considered forking, modifying, and submitting a pull request, but the latest version of the SDK here on GitHub is older than what I am pulling down with NuGet.