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

Updated Initialize.cs to show modern dotnet4+ versions #6128

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion DNN Platform/Library/Common/Initialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,20 @@ private static Version GetNETFrameworkVersion()
// Otherwise utilize release DWORD from registry to determine version
// Reference List: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies
var release = GetDotNet4ReleaseNumberFromRegistry();
if (release >= 533320)
{
version = "4.8.1 or later";
}
if (release >= 528040)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work? Doesn't this need to be in descending order? If release is 533320, that should mean 4.8.1, but then it will also be greater than 528040 and 461808, so won't version end up being set to "4.7.2"? Maybe I'm getting this mixed up in my head, but it doesn't read to me like it should work correctly without an else before each if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it doesn't. It was lazy-converted from using return "4.8";. I'll switch this pull to draft until I can get this done properly. Thanks!

{
version = "4.8";
}
else
if (release >= 461808)
{
version = "4.7.2";
}
// This code should never execute
version = "No 4.5 or later version detected (or unexpected result)";

return new Version(version);
}
Expand Down
Loading