Repository navigation
Keep the netstandard2.0 public API available on .NET #1736
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
Open
tmilnthorp
wants to merge
2
commits into
angularsen:master
Choose a base branch
from
tmilnthorp:tmilntho/consistent-tfm-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids --> | ||
| <!-- | ||
| Every public member available on netstandard2.0 must also exist on .NET, since a library compiled against | ||
| netstandard2.0 may run in an app that loads one of the .NET target frameworks. | ||
|
|
||
| The suppressions below are the intended exceptions: static abstract interface members and generic math | ||
| constraints, which require .NET 7 or later and cannot exist on netstandard2.0. Types implementing these | ||
| interfaces must therefore be compiled for .NET to run on .NET. | ||
| --> | ||
| <Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>M:UnitsNet.IQuantity`2.From(UnitsNet.QuantityValue,`1)</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>M:UnitsNet.IQuantityOfType`1.Create(UnitsNet.QuantityValue,UnitsNet.UnitKey)</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>P:UnitsNet.IAffineQuantity`2.Zero</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>P:UnitsNet.ILinearQuantity`1.Zero</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>P:UnitsNet.ILogarithmicQuantity`1.Zero</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>P:UnitsNet.IQuantity`2.Info</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0006</DiagnosticId> | ||
| <Target>P:UnitsNet.IQuantityOfType`1.Info</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0021</DiagnosticId> | ||
| <Target>T:UnitsNet.IAffineQuantity`2``1:T:System.Numerics.IAdditiveIdentity{`1,`1}</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0021</DiagnosticId> | ||
| <Target>T:UnitsNet.IAffineQuantity`3``2:T:System.Numerics.IAdditiveIdentity{`2,`2}</Target> | ||
| <Left>lib/netstandard2.0/UnitsNet.dll</Left> | ||
| <Right>lib/net8.0/UnitsNet.dll</Right> | ||
| </Suppression> | ||
| </Suppressions> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
[P2] Supply a default getter for direct IQuantityOfType implementations
This adds an abstract instance member to the modern .NET interface. The default at line 153 only protects implementations of IQuantity<TSelf,TUnit>. A type implementing IQuantityOfType directly compiled against the base, but fails to recompile against this head with CS0738. Loading that same unchanged assembly with this head throws TypeLoadException because get_QuantityInfo has no implementation.
On .NET, give this property a default body using the implementation's existing IQuantity metadata:
Keep the existing obsolete annotation and the netstandard2.0 abstract declaration. The fuller interface's TSelf.Info override can remain. TQuantity.Info is not available here because TQuantity is constrained only to IQuantity.
I tested this change with an unchanged pre-patch direct implementation: it now loads, returns the expected metadata and successfully calls Create through that metadata. Please add a regression test using a direct implementation that does not supply the new getter; the existing Mass/HowMuch test only covers the fuller interface.