Skip unnecessary BCL package reference if targeting .NET 6 or later #857
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #852, I would like to introduce multi-targeting only to skip an unnecessary package reference (
Microsoft.Bcl.AsyncInterfaces
) on .NET 6 and later, because it's already included by default.A (positive?) side effect of targeting
net6.0
is that a few warnings appeared in existing code because of new nullable reference types annotations. For instance,IServiceProvider.GetService(Type serviceType)
:object
innetstandard2.0
object?
innet6.0
At runtime, the behavior is the same. It's just that Microsoft added more hints to prevent null reference exceptions. I had to fix these warnings, and that explains the number of changes.
While fixing these warnings in
Mediator.cs
, I also added:InvalidOperationException
if we can't create the wrapper for stream requests handlers (instead of null-ref ex),InvalidOperationException
messages