Following a recent PR that improved performance by removing the initialization of a value assigned to an unused variable, I wanted to enable more analyzers to prevent this in future.
Unfortunately there's not an analyzer that'll catch all instances of this. Within VS we have `IDE0059` already, and this PR turns it into an error (rather than a hint) but it won't catch everything.
The things it did flag are fixed here.
These warnings are helpful in general. They flag apparently incorrect use of `Stream.Read`, where the return value is unused. In the abstract, reading from a stream into a buffer is not guaranteed to return all the bytes requested, as those bytes may not yet be available.
The cases covered by these three diagnostics are all in very old VB code, which hasn't been touched in ~15 years. My investigation suggests that all usages operate on `MemoryStream` which will actually always return the bytes you request.
I feel it's less risky to just suppress these warnings rather than trying to fix them.
The 9.0.0-rc.2.24473.5 version is causing issues in CI due to package downgrades being reported as errors. Building locally suggests that 8.0.0 is fine for our solution, so this drops the version.
The nested ToReferenceItem method was creating an ImmutableArray, but not using it. Went ahead and removed that line, and then since that method was only a single line, just pushed it's remaining contents to the caller.
There was a surprising amount of allocations going on in this line, which I happened to find while looking at the solution load section of a speedometer trace. Overall, this was about 0.3% of allocations in this profile.
Previously the ordering was "natural" ascending. This created a block with ".NET 5+" items at the top, and ".NET Core" items below, however the newest .NET item (e.g. ".NET 9") would be in the middle of the list.
The change here adds sorting by group, then by version, and makes that version ordering descending. This means that the latest and greatest version is always at the top of the list.
In the Project Properties UI, if a user has not specified a `<TargetFramework>` element in their project, we should not show an empty list of values to select from.
Instead, show the `.NETCoreApp` target frameworks, as the user may be in this state when manually editing their project file.
The base class does exactly the same logic as this class. Doing this here adds a little size to the object (not a big deal) and is potentially confusing (a bigger deal).