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

‘infinite’ is an invalid DateTime #50

Closed
stjohann opened this issue Jul 15, 2019 · 2 comments · Fixed by #51
Closed

‘infinite’ is an invalid DateTime #50

stjohann opened this issue Jul 15, 2019 · 2 comments · Fixed by #51
Assignees
Milestone

Comments

@stjohann
Copy link
Contributor

Hey, first of all, great library :-)

Some wikis (most of them?) use infinite in block expiration options, among them are Dutch Wikipedia and Wikitech. Fetching SiteInfo with this library with an active block from those wikis (for me, it is a block for hosting range) returns a FormatException in my bot.

I suspect that there can also be indefinite value triggering the same error, but I don’t have administrative tools anywhere to test the theory.

Fix should be pretty simple: adding infinite as an alias to infinity where applicable. This will close stjohann/DiscordWikiBot#3 for me.

Shortened trace log:

[2019-07-15 22:16:19] [DiscordWikiBot] [Error] Exception occurred: System.AggregateException: Exceptions occured within one or more event handlers. Check InnerExceptions for details. (One or more errors occurred. (The string 'infinite' was not recognized as a valid DateTime. There is an unknown word starting at index '0'.)) ---> System.AggregateException: One or more errors occurred. (The string 'infinite' was not recognized as a valid DateTime. There is an unknown word starting at index '0'.) ---> System.FormatException: The string 'infinite' was not recognized as a valid DateTime. There is an unknown word starting at index '0'.
   at System.DateTimeParse.Parse(ReadOnlySpan`1 s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.DateTime.Parse(String s, IFormatProvider provider, DateTimeStyles styles)
   at WikiClientLibrary.Infrastructures.WikiDateTimeJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
...
@CXuesong
Copy link
Owner

CXuesong commented Jul 16, 2019

Glad you like this library.

This is likely to be a regression introduced when I'm resolving #49 . Unfortunately I'm on trip for the rest of the week. You may consider falling back to v0.7.0-int.2 to try to mitigate the current situation.

I realized it's just a case I haven't been aware of. So I will make the change when I'm back. During this time, you may consider doing some local build (and perhaps open a PR 😉). There is currently no CI/CD so I will have to publish the package on my PC.

@CXuesong CXuesong reopened this Jul 16, 2019
@CXuesong CXuesong self-assigned this Jul 16, 2019
@CXuesong CXuesong added this to the v0.7.0 milestone Jul 16, 2019
@stjohann
Copy link
Contributor Author

stjohann commented Jul 16, 2019

For reference, these seem to be all values that are treated as infinity in MediaWiki time functions (found via codesearch):
https://gerrit.wikimedia.org/g/mediawiki/core/+/cbf8446b74b616a00024ef27225bd1e12ffd3bf6/includes/GlobalFunctions.php#2990

I can do a pull request about this if that’s convenient. This is not a critical error for my library, btw, I just got to finally know the cause.

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

Successfully merging a pull request may close this issue.

2 participants