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

Make TimeZoneNames trimmable #86

Closed
jnyrup opened this issue Oct 1, 2022 · 1 comment
Closed

Make TimeZoneNames trimmable #86

jnyrup opened this issue Oct 1, 2022 · 1 comment

Comments

@jnyrup
Copy link
Contributor

jnyrup commented Oct 1, 2022

With the switch to System.Text.Json in #85 we can further improve TimeZoneNames for NativeAOT applications by switching to a source generated TimeZoneData JSON deserializer.

Here's a POC on top of https://github.com/mattjohnsonpint/TimeZoneNames/tree/wip

Unfortunately System.Text.Json does not (yet) support init only properties, see dotnet/runtime#58770.

Here's some stats about the TimeZoneNames.NativeAot test application included in the linked POC.

main:
File size of TimeZoneNames.NativeAot.exe is 6091 KB
Crashes at runtime with

Unhandled Exception: System.TypeInitializationException: TypeInitialization_Type_NoTypeAvailable
	---> System.NotSupportedException: DeserializeNoConstructor, JsonConstructorAttribute, TimeZoneNames.TimeZoneData Path: $ | LineNumber: 0 | BytePositionInLine: 1.
	---> System.NotSupportedException: DeserializeNoConstructor, JsonConstructorAttribute, TimeZoneNames.TimeZoneData

POC:
File size of TimeZoneNames.NativeAot.exe is 4332 KB
Outputs TimeZone data to console at runtime.

@mattjohnsonpint
Copy link
Owner

Hi. Can you please reattempt this as a draft PR on top of the current main? Thanks.

@mattjohnsonpint mattjohnsonpint closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2022
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

No branches or pull requests

2 participants