-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Make OrderBy binary compat across TFMs #68036
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
Conversation
This puts `OrderBy` back into our Workspaces layer. It also addresses a number of other places where our `internal` API was not consistent with `public` API when polyfills were involved. Please consult the markdown doc for the rational here. That is going to be a repo artifact so lets focus the _why_ discussion there. Want it to be clear for future readers why this change is being made.
|
|
||
| It is not reasonable for us to take the union of all TFM and multi-target every single project to them. That would add several hundred compilations to any build operation which would in turn negatively impact our developer throughput. Instead we attempt to use the TFM where needed. That keeps our builds smaller but increases complexity a bit as we end up shipping a mix of TFM for binaries across our layers. | ||
|
|
||
| # Require consistent API across Target Frameworks |
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.
@sharwell is looking into an analyzer that can make this automatically enforced vs manually enforced. That will be handled in a different PR. This doc will still serve as a good why that analyzer exists.
|
@dotnet/roslyn-infrastructure, @dotnet/roslyn-compiler PTAL |
docs/Target Framework Strategy.md
Outdated
|
|
||
| This problem primarily comes from our use of polyfill APIs. To avoid this we employ the following rule: | ||
|
|
||
| > When there is an `#if NET.*` that declares a non-private member, there must be an `#else` that defines an equivalent binary compatible symbol |
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.
In this case, #if NET.* is a regular expression, but it could be confused as a glob by the reader where . is literal.
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.
Tried to clean that up a bit.
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.
Why not use NET... everywhere for consistency?
Co-authored-by: Sam Harwell <[email protected]> Co-authored-by: Chris Sienkiewicz <[email protected]>
|
|
||
| ```csharp | ||
| #if NET7_0_OR_GREATER | ||
| public static IOrderedEnumerable<T> Order<T>(IEnumerable<T> source) where T : IComparable<T> |
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.
Feels like there's less of a chance of error if we just #if the this keyword, rather than the whole signature.
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.
I thought that too but it looked really awful when I wrote it that way.
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.
public static IOrderedEnumerable<T> Order<T>(
#if !NET7_0_OR_GREATER
this
#endif
IEnumerable<T> source) where T : IComparable<T>Yea... idk if I like that
Co-authored-by: Jan Jones <[email protected]> Co-authored-by: Fred Silberberg <[email protected]>
|
Test failure is unrelated. |
This puts
OrderByback into our Workspaces layer. It also addresses a number of other places where ourinternalAPI was not consistent withpublicAPI when polyfills were involved.Please consult the markdown doc for the rational here. That is going to be a repo artifact so lets focus the why discussion there. Want it to be clear for future readers why this change is being made.