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

[BUG] Upgrading Oqtane version 5 => 6 leaves old libraries behind #4848

Open
enfJoao opened this issue Nov 20, 2024 · 8 comments
Open

[BUG] Upgrading Oqtane version 5 => 6 leaves old libraries behind #4848

enfJoao opened this issue Nov 20, 2024 · 8 comments

Comments

@enfJoao
Copy link

enfJoao commented Nov 20, 2024

Oqtane Info

Version - 6
Render Mode - Static
Interactivity - Server
Database - SQL Server

Describe the bug

Oqtane had a System.Text.Json.dll in the root folder.
Upgrading to Oqtane 6.0 places a new one in /refs/, but leaves the old one behind, causing issues such as 2sic/2sxc#3510

The update needs to remove these old libraries to prevent this issues.

@sbwalker
Copy link
Member

In #4755 there was a discussion about .NET assemblies changing locations in .NET 9. The following report provides a comparison of assemblies in .NET 8 vs .NET 9:

https://www.oqtane.org/files/Public/NET9.html

@enfJoao
Copy link
Author

enfJoao commented Nov 20, 2024

Sorry. Not sure what to do with this info.
Check each one of the 100 files?

@sbwalker
Copy link
Member

sbwalker commented Nov 20, 2024

Sorry... I should have provided more context. Basically the report shows that there are a LOT of assemblies which changed locations in .NET 9. However I have upgraded ~10 installations to Oqtane 6.0 at this point and I have not encountered any difficulties. These installations do include custom modules - and I have not experienced any issues with any of them. Now, 2SXC is a very large, sophisticated module - and likely has more dependencies than even the Oqtane framework itself, so this may be why it is having some upgrade challenges. But I am not sure what the Oqtane framework can realistically do to prevent these types of upgrade issues in custom modules?

@sbwalker
Copy link
Member

sbwalker commented Nov 20, 2024

When Oqtane 5.0 was released on .NET 8 there was a problem with some legacy Oqtane assemblies which were not removed and some upgrade logic was added to remove them:

                try
                {
                    // delete legacy Views assemblies which will cause startup errors due to missing HostModel
                    // note that the following files will be deleted however the framework has already started up so a restart will be required
                    var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                    var filepath = Path.Combine(binFolder, "Oqtane.Server.Views.dll");
                    if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
                    filepath = Path.Combine(binFolder, "Oqtane.Server.Views.pdb");
                    if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
                }
                catch (Exception ex)
                {
                    // error deleting file
                    Debug.WriteLine($"Oqtane Error: Error In 5.1.0 Upgrade Logic - {ex}");
                }

This seemed to address the problem for some people. It works as long as the framework is actually able to start up and reach the upgrade code to execute it. The user experience is still not great as an error is still displayed to the user in the browser, but when they manually restart the app it will no longer encounter the error.

@enfJoao
Copy link
Author

enfJoao commented Nov 21, 2024

Sorry, but I don't see how this is related to 2sxc...
If you check the latest Oqtane 5 release, it has the System.Text.Json.dll (v8) on the root folder.
When I updated to Oqtane 6, it placed a new System.Text.Json.dll (v9) on the refs folder, without deleting the old one.
Is this not something that could have been prevented?
Even now, is there any way to quickly check if I still have other duplicated libraries?

@sbwalker
Copy link
Member

sbwalker commented Nov 21, 2024

List of files moved from /bin to /bin/refs in .NET 9:

Microsoft.AspNetCore.Authorization.dll
Microsoft.AspNetCore.Components.Authorization.dll
Microsoft.AspNetCore.Components.dll
Microsoft.AspNetCore.Components.Forms.dll
Microsoft.AspNetCore.Components.Web.dll
Microsoft.AspNetCore.Cryptography.Internal.dll
Microsoft.AspNetCore.Cryptography.KeyDerivation.dll
Microsoft.AspNetCore.Metadata.dll
Microsoft.Extensions.Caching.Memory.dll
Microsoft.Extensions.Configuration.Binder.dll
Microsoft.Extensions.Configuration.FileExtensions.dll
Microsoft.Extensions.Configuration.Json.dll
Microsoft.Extensions.DependencyInjection.Abstractions.dll
Microsoft.Extensions.DependencyInjection.dll
Microsoft.Extensions.Diagnostics.Abstractions.dll
Microsoft.Extensions.Diagnostics.dll
Microsoft.Extensions.Http.dll
Microsoft.Extensions.Identity.Core.dll
Microsoft.Extensions.Identity.Stores.dll
Microsoft.Extensions.Localization.Abstractions.dll
Microsoft.Extensions.Localization.dll
Microsoft.Extensions.Logging.Abstractions.dll
Microsoft.Extensions.Logging.dll
Microsoft.JSInterop.dll
System.Text.Json.dll

List of files removed completely in .NET 9:

System.Runtime.Caching.dll

Anomalies:

Microsoft.Extensions.Options.dll

assembly existed in multiple locations in .NET 8
/bin = 64,776 bytes
/bin/refs folder = 31,496 bytes

assembly exists in only 1 location in .NET 9
/bin/refs folder = 31,512 bytes

@enfJoao
Copy link
Author

enfJoao commented Nov 21, 2024

My install refuses to start without System.Runtime.Caching.dll
HTTP Error 500.30 - ASP.NET Core app failed to start

Everything else was deleted with no issues.

@sbwalker
Copy link
Member

sbwalker commented Nov 21, 2024

Does your Oqtane install have any 3rd party modules? If so, then it is likely that it is a 3rd party module which has a dependency on System.Runtime.Caching.dll - which is causing the ASP.NET Core exception (as Oqtane itself has no dependency on that assembly)

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