oqtane / oqtane.framework

CMS & Application Framework for Blazor & .NET MAUI
http://www.oqtane.org
MIT License
1.89k stars 547 forks source link

remove Microsoft.AspNetCore.Localization dependency #4774

Closed sbwalker closed 1 month ago

sbwalker commented 1 month ago

note this PR adds Microsoft.AspNetCore.Http which will need to be removed in a subsequent PR

hishamco commented 1 month ago

Is there a reason to remove it?

sbwalker commented 1 month ago

@hishamco Microsoft.AspNetCore.Localization version 2.2.0 has been flagged as deprecated for quite some time (https://github.com/dotnet/announcements/issues/217). In .NET 9 it is now flagged as containing a critical severity vulnerability:

warning NU1904: Package 'System.Text.Encodings.Web' 4.5.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-ghhp-997w-qr28

System.Text.Encodings.Web is part of Microsoft.AspNetCore.Localization

sbwalker commented 1 month ago

@hishamco Microsoft.AspNetCore.Http also contains System.Text.Encodings.Web as well so it has a similar problem in the upgrade to .NET 9. You can read more about it here: https://github.com/dotnet/aspnetcore/issues/58593

hishamco commented 1 month ago

Yes, I remembered that above announcement, but still a part of AspNetCore https://github.com/dotnet/aspnetcore/tree/main/src/Middleware/Localization/src I'm not sure why you are trying to implement RequestCulture and CookieRequestCultureProvider yourself?!!

sbwalker commented 1 month ago

@hishamco please read: https://github.com/dotnet/aspnetcore/issues/58593 - it is not possible to access Microsoft.AspNetCore.App from within a Blazor Client project (ie. <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">). CookieRequestCultureProvider is only available in Microsoft.AspNetCore.App so there is no way to access it in a Blazor Client project. This is a major headache in upgrading to .NET 9.

hishamco commented 1 month ago

Maybe I didn't dig into the latest link, so can we add Oqtane.Localization project or namespace for that to make things much cleaner and organized

This is a major headache in upgrading to .NET 9.

Good to know that

sbwalker commented 1 month ago

"can we add Oqtane.Localization project or namespace" I would prefer not to at this time as I am still exploring various solutions to try to avoid copying these classes into Oqtane

hishamco commented 1 month ago

Do you want me to try something?