-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Manually backflow VMR's main #50780
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
base: main
Are you sure you want to change the base?
Manually backflow VMR's main #50780
Conversation
This PR is targeting |
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.
Pull Request Overview
This PR performs a manual backflow of changes from VMR's main branch, primarily updating dependency versions across the dotnet/sdk repository from rc.2 to rc.1 versions while maintaining compatibility. The changes include version updates, some code refactoring to remove nullable references, and improvements to build configurations.
Key changes include:
- Updating dependency versions from 25427 build to 25461 build across multiple packages
- Removing
#nullable disable
directives and updating property declarations - Refactoring Razor SDK serialization code for better type safety
Reviewed Changes
Copilot reviewed 17 out of 52 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs | Removes nullable annotations and refactors property declarations, updates runtime pack logic |
src/RazorSdk/Tool/Json/*.cs | Updates JSON serialization for TagHelper descriptors with improved type safety |
src/Layout/redist/targets/*.targets | Updates portable runtime identifier configurations and removes platform-specific conditions |
global.json, eng/Version.Details.xml, eng/Version.Details.props | Updates Arcade SDK and dependency package versions |
src/Cli/dotnet/*.cs | Updates command line action implementations |
eng/common/. | Updates source indexing and SBOM generation package versions |
{ | ||
var knownFrameworkReferenceRuntimePackRuntimeIdentifiers = selectedPack.RuntimePackRuntimeIdentifiers.Split(';'); | ||
var knownFrameworkReferenceRuntimePackRuntimeIdentifiers = selectedRuntimePack?.RuntimePackRuntimeIdentifiers.Split(';'); |
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.
Potential null reference exception. The code uses null-conditional operator ?.
but then immediately calls Split(';')
on the result, which could be null. This should either check for null before calling Split or use a safe pattern.
var knownFrameworkReferenceRuntimePackRuntimeIdentifiers = selectedRuntimePack?.RuntimePackRuntimeIdentifiers.Split(';'); | |
var knownFrameworkReferenceRuntimePackRuntimeIdentifiers = (selectedRuntimePack?.RuntimePackRuntimeIdentifiers ?? string.Empty).Split(';'); |
Copilot uses AI. Check for mistakes.
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.
@baronfel fyi some usefully-looking tips here from Mr.Copilot towards the file you've been working with recently
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.
This indeed risks a null reference exception, but Copilot explains it wrong.
selectedRuntimePack?.RuntimePackRuntimeIdentifiers.Split(';')
means
selectedRuntimePack is null ? null : (selectedRuntimePack.RuntimePackRuntimeIdentifiers.Split(';'))
so, if selectedRuntimePack is null, then Split is not called, and NullReferenceException is not thrown from there; knownFrameworkReferenceRuntimePackRuntimeIdentifiers just becomes (string[])null
. However, that then causes the foreach
loop immediately below to throw NullReferenceException when it tries to enumerate the array.
foreach (var runtimeIdentifier in knownFrameworkReferenceRuntimePackRuntimeIdentifiers) | ||
{ | ||
foreach (var runtimePackNamePattern in selectedPack.RuntimePackNamePatterns.Split(';')) | ||
foreach (var runtimePackNamePattern in selectedRuntimePack?.RuntimePackNamePatterns.Split(';')) |
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.
Similar null reference issue as above. The null-conditional operator is used but Split is called on a potentially null result.
foreach (var runtimePackNamePattern in selectedRuntimePack?.RuntimePackNamePatterns.Split(';')) | |
foreach (var runtimePackNamePattern in (selectedRuntimePack?.RuntimePackNamePatterns ?? string.Empty).Split(';')) |
Copilot uses AI. Check for mistakes.
runtimePackVersion = knownRuntimePack?.LatestRuntimeFrameworkVersion; | ||
return knownRuntimePack?.LatestRuntimeFrameworkVersion; |
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.
Inconsistent null handling. The code assigns and returns the same nullable value without null checking, which could propagate null values unexpectedly.
runtimePackVersion = knownRuntimePack?.LatestRuntimeFrameworkVersion; | |
return knownRuntimePack?.LatestRuntimeFrameworkVersion; | |
runtimePackVersion = knownRuntimePack.LatestRuntimeFrameworkVersion ?? knownFrameworkReference.DefaultRuntimeFrameworkVersion; | |
return knownRuntimePack.LatestRuntimeFrameworkVersion ?? knownFrameworkReference.DefaultRuntimeFrameworkVersion; |
Copilot uses AI. Check for mistakes.
{ | ||
runtimePackVersion = knownPack2.LatestRuntimeFrameworkVersion; | ||
runtimePackVersion = knownRuntimePack?.LatestRuntimeFrameworkVersion; |
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.
Same issue as above - assigning potentially null value without proper null handling.
runtimePackVersion = knownRuntimePack?.LatestRuntimeFrameworkVersion; | |
runtimePackVersion = knownRuntimePack.LatestRuntimeFrameworkVersion ?? knownFrameworkReference.DefaultRuntimeFrameworkVersion; |
Copilot uses AI. Check for mistakes.
{ | ||
string? value = frameworkReference?.GetMetadata("TargetLatestRuntimePatch"); | ||
string value = frameworkReference?.GetMetadata("TargetLatestRuntimePatch"); |
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.
The variable value
could be null but is used in subsequent string operations without null checking.
Copilot uses AI. Check for mistakes.
{ | ||
string? requestedVersion = frameworkReference?.GetMetadata("RuntimeFrameworkVersion"); | ||
string requestedVersion = frameworkReference?.GetMetadata("RuntimeFrameworkVersion"); |
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.
Similar issue - requestedVersion
could be null but is used without proper null checking in the following code.
Copilot uses AI. Check for mistakes.
@marcpopMSFT @SimonZhao888 @mmitche @akoeplinger I still had to manually backflow as SDK is the place where the metadata was messed up (so the manual forward flow was not enough). The changes here mostly come from this VMR commit: dotnet/dotnet@73c9eac I expect this PR might suffer from similar problems like the 10.0.1xx one so
|
Lot of failures are C:\h\w\AA3B0949\p\d\sdk\10.0.100-ci\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(119,5): error MSB4018: System.ArgumentNullException: Value cannot be null. (Parameter 'key') I think we need baronfel's change that was in 10.0.1xx |
Here is baronfel's commit: Fix process framework references crash when null RID is passed |
@marcpopMSFT that change was already part of the branch here though as it merged into |
57b6a3a
to
f2bc305
Compare
That change has flowed to main outside this PR now so rebasing and rerunning to see if that helps. |
I merged |
Backflowing dotnet/dotnet@5d79341
dotnet/arcade-services#5231