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

Nullable DateTime converter clears data in json config file #82

Closed
IlinAleksey opened this issue Apr 9, 2022 · 2 comments · Fixed by #100
Closed

Nullable DateTime converter clears data in json config file #82

IlinAleksey opened this issue Apr 9, 2022 · 2 comments · Fixed by #100

Comments

@IlinAleksey
Copy link

IlinAleksey commented Apr 9, 2022

Using [UseConverter] attribute for properties with type DateTime? causes strange behaviour when GeneratedStore.Generated function is called. Some date data in config file is reset to null, and what data exactly is reset to null is even more strange: only dates with even seconds, so value "2022-03-23T18:33:43.0000000" won't be reset, but "2022-03-23T18:33:44.0000000" will be.

I don't know if it's a BSIPA bug or I use these methods and attributes wrong, or there is some silly environment issue on my side. [UseConverter] for other types (string, int) works fine btw

Steps to reproduce:

  • define class SimpleStore
    internal class SimpleStore
    {
        public static SimpleStore Instance { get; set; }

        [UseConverter]
        public virtual DateTime? Date { get; set; }
    }
  • create file SimpleStore.json in UserData folder with contents
{
  "Date": "2022-03-23T18:33:44.0000000"
}
  • call SimpleStore.Instance = Config.GetConfigFor("SimpleStore").Generated<Configuration.SimpleStore>(); in InitWithConfig

  • build, launch game, don't even have to wait for the main menu to appear

  • contents of SimpleStore.json is now

{
  "Date": null
}
@nike4613
Copy link
Owner

nike4613 commented Apr 9, 2022

Can I get a log file of this happening?

@IlinAleksey
Copy link
Author

IlinAleksey commented Apr 9, 2022

Can I get a log file of this happening?

20220409-1207.log

Log of the game launch
The plugin i am debugging is called "Song Browser"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants