Skip to content

Commit

Permalink
Re-enable ApiCompat ref<->src assembly validation (#81104)
Browse files Browse the repository at this point in the history
* Re-eanble ApiCompat ref<->src assembly validation

* Fix API compatibility differences and update ApiCompat baseline

* Fix mono build

* Disable ApiCompat for linker
  • Loading branch information
ViktorHofer authored Jan 25, 2023
1 parent d5b23bd commit 1145e01
Show file tree
Hide file tree
Showing 10 changed files with 2,528 additions and 164 deletions.
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@
</AssemblyAttribute>
</ItemGroup>

<PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
<!-- Must be defined in a props file as imports in Microsoft.DotNet.ApiCompat.Task.targets depend on it. -->
<ApiCompatValidateAssemblies>true</ApiCompatValidateAssemblies>
</PropertyGroup>

<PropertyGroup Condition="'$(IsGeneratorProject)' == 'true'">
<!-- Unique assembly versions increases(3x) the compiler throughput during reference package updates. -->
<AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
Expand Down
1 change: 0 additions & 1 deletion eng/resolveContract.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<!-- ##### APICompat settings ##### -->

<PropertyGroup>
<ApiCompatValidateAssemblies>true</ApiCompatValidateAssemblies>
<ApiCompatContractItemName>ResolvedMatchingContract</ApiCompatContractItemName>
<ApiCompatStrictMode Condition="'$(ApiCompatStrictMode)' == ''">true</ApiCompatStrictMode>

Expand Down
141 changes: 3 additions & 138 deletions src/libraries/System.Linq.Queryable/ref/System.Linq.Queryable.cs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/libraries/System.Net.Security/ref/System.Net.Security.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ protected AuthenticatedStream(System.IO.Stream innerStream, bool leaveInnerStrea
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
}
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")]
public sealed partial class CipherSuitesPolicy
{
[System.CLSCompliantAttribute(false)]
Expand Down Expand Up @@ -302,6 +304,9 @@ public override void EndWrite(System.IAsyncResult asyncResult) { }
~SslStream() { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")]
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
[System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd")]
public virtual System.Threading.Tasks.Task NegotiateClientCertificateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
Expand Down
1 change: 1 addition & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13884,6 +13884,7 @@ public static class Ascii
}
public sealed class CompositeFormat
{
internal CompositeFormat() { }
public static System.Text.CompositeFormat Parse([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("CompositeFormat")] string format) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("CompositeFormat")] string format, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Text.CompositeFormat? compositeFormat) { throw null; }
public string Format { get { throw null; } }
Expand Down
2,533 changes: 2,509 additions & 24 deletions src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0014</DiagnosticId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static int GetHashCode(object? o)
/// The advantage of this over <see cref="GetHashCode" /> is that it avoids assigning a hash
/// code to the object if it does not already have one.
/// </remarks>
public static int TryGetHashCode(object? o)
internal static int TryGetHashCode(object? o)
{
return InternalTryGetHashCode(o);
}
Expand Down
2 changes: 2 additions & 0 deletions src/tools/illink/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<!-- Arcade uses by default xunit as test runner, illink uses nunit instead.
We need to setup UseVSTestRunner to use the runner VS is using (in this case nunit) -->
<UseVSTestRunner>true</UseVSTestRunner>
<!-- TODO: Fix the api differences between the ref and src linker. -->
<ApiCompatValidateAssemblies>false</ApiCompatValidateAssemblies>
</PropertyGroup>

<PropertyGroup Condition="'$(IsReferenceAssembly)' == 'true'">
Expand Down

0 comments on commit 1145e01

Please sign in to comment.