Skip to content
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

Update Package Validation dependency and update Suppression files #60306

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>9a1f02eff42635a5a9934735f12c722c3bfba8e8</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Compatibility" Version="1.0.0-rc.2.21419.17">
<Dependency Name="Microsoft.DotNet.Compatibility" Version="1.0.0-rc.2.21511.46">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>c293382261f9f932c772a095ff3c2f6bd97f2cf9</Sha>
<Sha>f6028bc958dbab0094be39b94ba9e9c761cde13f</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<MicrosoftCodeAnalysisCSharpVersion>3.10.0</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-rc1.21413.4</MicrosoftCodeAnalysisNetAnalyzersVersion>
<!-- SDK dependencies -->
<MicrosoftDotNetCompatibilityVersion>1.0.0-rc.2.21419.17</MicrosoftDotNetCompatibilityVersion>
<MicrosoftDotNetCompatibilityVersion>1.0.0-rc.2.21511.46</MicrosoftDotNetCompatibilityVersion>
<!-- Arcade dependencies -->
<MicrosoftDotNetApiCompatVersion>6.0.0-beta.21507.1</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetBuildTasksFeedVersion>6.0.0-beta.21507.1</MicrosoftDotNetBuildTasksFeedVersion>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.SettingsAttributeDictionary.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)</Target>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all of these violations "known" issues with netstandard2.0 vs net461?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. Most of these are due to the library being a facade to some .NET Framework assembly, and then having the type in .NET Framework missing API. This particular one typeforwards to System.dll, which doesn't have the serialization constructor for this type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we weren't following type forwards, which is why we basically were blindly just suppressing all CP001 (missing types) as the net461 facade "wouldn't have the type". Now with the improved package validation, we follow the type forwards and find diffs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the idea being: "netstandard2.0 and net461 are both locked and won't take any more API changes ever, so we just baseline the diffs to make the tool happy" is that about right? We don't need to verify that these are expected/known diffs, because even if they aren't, we can't fix them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eerhardt also note that these changes are already in main for some days.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we can't go back and remove and API from ns2.0 or add it to net461, but these are definitely mistakes when we authored these packages, but we never ran API Compat in between ref vs compatible implementations, which is why they are showing up now that we actually validate the structure of the package. Which is sad that we can't do anything but suppress them, but at least shows the tool is going to bring value in the future.

<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net461/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.SettingsContext.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)</Target>
<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net461/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.Internal.DelegatingConfigHost.RefreshConfigPaths</Target>
<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net461/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.Internal.DelegatingConfigHost.get_HasLocalConfig</Target>
<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net461/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.Internal.DelegatingConfigHost.get_HasRoamingConfig</Target>
<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net461/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.Internal.DelegatingConfigHost.get_IsAppConfigHttp</Target>
<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net461/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
Expand Down
33 changes: 14 additions & 19 deletions src/libraries/System.Data.Odbc/src/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Left>lib/netstandard2.0/System.Data.Odbc.dll</Left>
<Right>lib/net461/System.Data.Odbc.dll</Right>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcParameter.get_Offset</Target>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems interesting ....

<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/net6.0/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32)</Target>
<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/net6.0/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
Expand Down Expand Up @@ -92,14 +99,14 @@
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcParameter.get_Offset</Target>
<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/net6.0/System.Data.Odbc.dll</Right>
<Left>lib/netcoreapp3.1/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32)</Target>
<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/net6.0/System.Data.Odbc.dll</Right>
<Left>lib/netcoreapp3.1/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
Expand Down Expand Up @@ -137,18 +144,6 @@
<Left>lib/netcoreapp3.1/System.Data.Odbc.dll</Left>
<Right>runtimes/osx/lib/netcoreapp3.1/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcParameter.get_Offset</Target>
<Left>lib/netcoreapp3.1/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32)</Target>
<Left>lib/netcoreapp3.1/System.Data.Odbc.dll</Left>
<Right>runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Data.Odbc.ODBC32</Target>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Drawing.Graphics.GetContextInfo(System.Drawing.PointF@)</Target>
Copy link
Member

@safern safern Oct 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one we can definitely fixit as this is a new APIs that were added to the 6.0 package, IMHO I think we should just expose these new APIs on the net5.0 or net6.0 ref assembly rather than in the netstandard2.0 one.

@ericstj @JeremyKuhne thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be my vote.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericstj @danmoseley is that a change we can still do this late in the release?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the customer impact? I see it in the ref

public void GetContextInfo(out PointF offset) { throw null; }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The customer impact is that we are exposing it in a netstandard2.0 ref but there is no implementation for this API in the net472 implementation, cause it is just a facade to System.Drawing.dll, which of course doesn't contain it. So customers that target ns2.0 and then run on net472 would get this API at compile time but fail with MethodNotFoundException at runtime.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to add to @safern's great explanation, these problems especially affect class libraries, which usually target netstandard2.0, so if one takes a dependency on one of these APIs, and then it gest consumed by a net461+ project, it will hit the exception at runtime as Santi explained.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, because they are new APIs, this is basically our last chance of fixing the issue, since after shipping, we will be effectively on the same boat as the rest of them where API surface won't be able to reduce.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems worth trying to take this week, unless there's risks/complications I'm not aware of. we added an API in the wrong place, in the same release we wrote an analyzer to find such mistakes, it finds it , ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll work on a fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Please let me know when you have a template to look at.

<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Drawing.Graphics.GetContextInfo(System.Drawing.PointF@,System.Drawing.Region@)</Target>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one as well.

<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Drawing.FontConverter</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Drawing.IconConverter</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Drawing.ImageConverter</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Drawing.ColorTranslator</Target>
<Target>T:System.Drawing.ImageFormatConverter</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/netcoreapp3.1/System.Drawing.Common.dll</Right>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Drawing.SystemColors</Target>
<Target>T:System.Drawing.Printing.MarginsConverter</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:System.Drawing.Imaging.Encoder.ColorSpace</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:System.Drawing.Imaging.Encoder.ImageItems</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/netcoreapp3.1/System.Drawing.Common.dll</Right>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:System.Drawing.Imaging.Encoder.SaveAsCmyk</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:System.Drawing.Imaging.EncoderParameterValueType.ValueTypePointer</Target>
<Left>lib/netstandard2.0/System.Drawing.Common.dll</Left>
<Right>lib/net461/System.Drawing.Common.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Left>lib/netstandard2.0/System.IO.Packaging.dll</Left>
<Right>lib/net461/System.IO.Packaging.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
<Target>.NETFramework,Version=v4.6</Target>
Expand Down
86 changes: 0 additions & 86 deletions src/libraries/System.IO.Ports/src/CompatibilitySuppressions.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>lib/netstandard2.0/System.Security.AccessControl.dll</Left>
<Right>lib/net461/System.Security.AccessControl.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>lib/netstandard2.0/System.Security.AccessControl.dll</Left>
<Right>lib/net461/System.Security.AccessControl.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Security.AccessControl.ObjectSecurity.get_SecurityDescriptor</Target>
<Left>lib/netstandard2.0/System.Security.AccessControl.dll</Left>
<Right>lib/net461/System.Security.AccessControl.dll</Right>
</Suppression>
Expand Down
Loading