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 8 Upgrade (Multi Framework targetting) #2181
Conversation
…ues that weren't causing issues in .net6. Also removed "ISystemClock" from authenticationhandlers as it is deprecated in .net8. Internally .net8 provides replacement so only change on our part was removing the param. all references to headerdictionary use trygetvalue and check that result count is 1 to make sure user didn't supply >1 role. when that is fulfilled , the stringvalues object is converted to string and the nullable error goes away.
Add framework dependent constructors for EasyAuth/SimulatorAuthenticationHandlers. Directory.Packages.Props now has framework dependent section to define separate package versions.
We know there are performance improvements from this even if we do not measure for them. This includes improvements to JIT compilation and reduced memory consumption. The .NET team has bragged about this too much for us not to see those benefits coming for free. But the best part is the improved developer experience with the latest C# language features—that's the win! By the way, .NET 8 is set to be EOL in 2026 (compared to .NET 7 in 2024). The team alternates LTS with only even versions (similar to DAB), which means our next upgrade will be .NET 10, not .NET 9 - which is considered a maintenance version. I bring this up because .NET 9 is right around the corner, and I don't want the team to feel discouraged to see .NET 9 coming out at the same time we upgrade to .NET 8. We're upgrading to the right version, LTS version of .NET, and it's perfect. |
Issue: dotnet/aspnetcore#53332
Present in ClientRoleHeaderAuthorizationMiddlewareTests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for usage of nuget.org
src/Core/AuthenticationHelpers/ClientRoleHeaderAuthenticationMiddleware.cs
Show resolved
Hide resolved
Also, check if we get different binaries for each of the target framework, and if not, would the same binary work for both .net 8/.net6 |
Fixed this via: dotnet/aspnetcore#53332 (comment) |
…aimtypes aren't used. (dotnet8 change, but this test modification is backwards compatible per successful "net6 tests".) update usings update notice file generation with latest sqlclient version behind scenes updated nuget dependency versions in our upstream feed. updating build pipeline comments. added mitigating helper function that is backwards compatible with net6 so that we don't get unhandled json exception that halts startup. revert accidental nuget feed change.
/azp run |
Ignore seralize/deserialize unit test due to attempting to serialize when latest .net guidance says not to. Attached github discussion link from dotnet/runtime.
…ta-api-builder into dev/sean/dotnet8upgrade
/azp run |
…nstall to dwsql/mssql windows pipelines. Not just linux.
…nd net8 config files in test project.
/azp run |
…ction string in configs in both net6 and net8 folders.
/azp run |
…and net8.0 target frameworks explicitly and then optionally zip all the output. Updated create-manifest-file to accommodate the net8 and net6 multitarget builds.
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/Service.Tests/Unittests/SerializationDeserializationTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…t to preserve running on .net6 and apply fix to running on .net8 by removing object converter. After testing , this still works but a better solution may exist. moved Microsoft.Extensions.Configuration.Json/Binder to targetframework specific directory.packages.props section to align dependency versions with dotnetruntime versions. this helped ensure .net6 version of serializationdeserialization test to pass on both runtimes.
/azp run |
Why make this change?
What is this change?
.csproj
files to target both .NET8 and .NET6. (source: How to multi targetAdded framework specific constructors for EasyAuth/Simulator AuthenticationHandlers because
ISystemClock
was deprecated in .NET8 and is a required constructor parameter when overridingAuthenticationHandler
dotnet class used for custom authentication handlers.Updated instances of pulling client role header value (GraphQLFilterParser, SqlMutationEngine) due to stricter nullability checks (now errors) in .NET 8. The following original code "possibly returns null" and needs to be handled.
Changed to be a conditional check:
OLD:
NEW
How was this tested?
This isn't a feature addition, but ensure that all existing tests pass.