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

.NET 6 gotcha #107

Closed
dmytro-gokun opened this issue Dec 3, 2021 · 9 comments
Closed

.NET 6 gotcha #107

dmytro-gokun opened this issue Dec 3, 2021 · 9 comments

Comments

@dmytro-gokun
Copy link

dmytro-gokun commented Dec 3, 2021

Readme file for this project states this:

.NET 6 will have built-in support for IANA and Windows time zones in a cross-platform manner, removing the need for the TimeZoneConverter library. If you are planning to use .NET 6 (or higher), you don't need to use the TimeZoneConverter library!

This is only partially true. The gotcha is that .NET 6 IANA support only works when you run your app on Windows 10 1903 and higher. Windows Server 2016 & 2019 are not supported (it works on Windows Server 2022 though). If you want to use this feature on those OSes you need to carry around icu.dll by adding this to you project file:

<ItemGroup>
    <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
    <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2" />
</ItemGroup>

and you need to do that in every .exe-producing project, you cannot just put in some shared DLL as it would not be applied. This also means that your unit tests DLLs will not work on those unsupported OSes no matter what.

So, i guess it's a bit too early to let this project die :). And I think it would be a good idea to add this word of caution about .NET 6 gotchas to the readme.

Thanks for the great library!

@ntimmerman
Copy link

What a pain in the ass.

@dmytro-gokun
Copy link
Author

@ntimmerman Yeah, it totally is. I was really happy when I've heard they've added this to .NET 6, but then i've actually tried it and went to the rabbit hole of the small print :)

@ntimmerman
Copy link

Any idea why the exception for current versions of windows server? We devs just want a write once, run anywhere experience without exceptions.

@dmytro-gokun
Copy link
Author

@ntimmerman
Copy link

It seems like the obvious solution is for Microsoft to put both on Windows Server (add ICU via patch) and allow the .net developer to specify which underlying lib to use. Or am I missing something?

@dmytro-gokun
Copy link
Author

hard to say. If you ask me, it should without requiring any 3rd party stuff apart of (maybe) a MS provided-nuget package. I have not idea why they've decided to do it this way :)

@mattjohnsonpint
Copy link
Owner

Thanks for bringing this up. Yes, the built-in .NET 6 support requires ICU in one form or another.

Don't worry, I'll not be killing this project any time soon. I am a little bit behind on maintenance, but I'll catch up soon and will update that note to clarify the ICU dependency for the built-in solution.

Thanks.

@mattjohnsonpint
Copy link
Owner

I added a note to the readme about ICU support for .NET 6.

@robertmadril
Copy link

Just a thank you to @mattjohnsonpint for continuing to support this project. The .NET 6 solution/workaround really adds an unnecessary layer of complexity to any project that is hosted on an Azure App Service. This approach is much preferred

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

4 participants