Skip to content

Commit

Permalink
Updating to a version of Roslyn that contains the NumericIntPtr featu…
Browse files Browse the repository at this point in the history
…re (#69627)

* Update MicrosoftNetCompilersToolsetVersion to 4.3.0-2.22270.2

* Updating IntPtr/UIntPtr and a handful of tests to handle the numeric-intptr feature

* Ensure IntPtr.TestExplicitCast and UIntPtr.TestExplicitCast correctly check the overflow exception

* Update the Microsoft.Dotnet.Compatibility analyzer to 2.0.0-preview.4.22252.4

* Updating the CompatibilitySuppressions for the NumericIntPtr feature

* Handle a difference in how the OverflowException is thrown for a reflected call on Mono

* Use Assert.ThrowsAny as that includes derived types for xUnit
  • Loading branch information
tannergooding authored May 21, 2022
1 parent e4ac5cd commit 7626c5d
Show file tree
Hide file tree
Showing 33 changed files with 1,772 additions and 653 deletions.
1 change: 1 addition & 0 deletions eng/ApiCompatExcludeAttributes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
T:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute
T:System.Diagnostics.DebuggerGuidedStepThroughAttribute
T:System.Runtime.CompilerServices.EagerStaticClassConstructionAttribute
T:System.Runtime.CompilerServices.NativeIntegerAttribute
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
<!--
TODO: Remove pinned version once arcade supplies a 4.3 compiler.
-->
<MicrosoftNetCompilersToolsetVersion>4.3.0-2.22261.3</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>4.3.0-2.22270.2</MicrosoftNetCompilersToolsetVersion>
<!-- SDK dependencies -->
<MicrosoftDotNetCompatibilityVersion>2.0.0-alpha.1.21525.11</MicrosoftDotNetCompatibilityVersion>
<MicrosoftDotNetCompatibilityVersion>2.0.0-preview.4.22252.4</MicrosoftDotNetCompatibilityVersion>
<!-- Arcade dependencies -->
<MicrosoftDotNetApiCompatVersion>7.0.0-beta.22255.2</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetBuildTasksFeedVersion>7.0.0-beta.22255.2</MicrosoftDotNetBuildTasksFeedVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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:Microsoft.Extensions.Caching.Memory.PostEvictionDelegate.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Extensions.Caching.Abstractions.dll</Left>
<Right>lib/net7.0/Microsoft.Extensions.Caching.Abstractions.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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:Microsoft.Extensions.DependencyInjection.ObjectFactory.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll</Left>
<Right>lib/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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:Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Extensions.DependencyInjection.Specification.Tests.dll</Left>
<Right>lib/net7.0/Microsoft.Extensions.DependencyInjection.Specification.Tests.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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:Microsoft.Win32.PowerModeChangedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.SessionEndedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.SessionEndingEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.SessionSwitchEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.SystemEvents.KillTimer(System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.TimerElapsedEventArgs.#ctor(System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.TimerElapsedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.UserPreferenceChangedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Win32.UserPreferenceChangingEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/Microsoft.Win32.SystemEvents.dll</Left>
<Right>lib/net7.0/Microsoft.Win32.SystemEvents.dll</Right>
</Suppression>
</Suppressions>
15 changes: 15 additions & 0 deletions src/libraries/System.CodeDom/src/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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.CodeDom.Compiler.Executor.ExecWaitWithCapture(System.IntPtr,System.String,System.CodeDom.Compiler.TempFileCollection,System.String@,System.String@)</Target>
<Left>lib/net6.0/System.CodeDom.dll</Left>
<Right>lib/net7.0/System.CodeDom.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.CodeDom.Compiler.Executor.ExecWaitWithCapture(System.IntPtr,System.String,System.String,System.CodeDom.Compiler.TempFileCollection,System.String@,System.String@)</Target>
<Left>lib/net6.0/System.CodeDom.dll</Left>
<Right>lib/net7.0/System.CodeDom.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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.Composition.Hosting.Core.CompositeActivator.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Composition.Hosting.dll</Left>
<Right>lib/net7.0/System.Composition.Hosting.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,40 @@
<Left>lib/netstandard2.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net462/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.SettingChangingEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net7.0/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.SettingsLoadedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net7.0/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.SettingsSavingEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net7.0/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.ValidatorCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net7.0/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.Internal.InternalConfigEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net7.0/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Configuration.Internal.StreamChangeCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Configuration.ConfigurationManager.dll</Left>
<Right>lib/net7.0/System.Configuration.ConfigurationManager.dll</Right>
</Suppression>
</Suppressions>
18 changes: 18 additions & 0 deletions src/libraries/System.Data.Odbc/src/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,22 @@
<Right>lib/netstandard2.0/System.Data.Odbc.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcInfoMessageEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>lib/net7.0/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcRowUpdatedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>lib/net7.0/System.Data.Odbc.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.Odbc.OdbcRowUpdatingEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Data.Odbc.dll</Left>
<Right>lib/net7.0/System.Data.Odbc.dll</Right>
</Suppression>
</Suppressions>
21 changes: 21 additions & 0 deletions src/libraries/System.Data.OleDb/src/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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.Data.OleDb.OleDbInfoMessageEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Data.OleDb.dll</Left>
<Right>lib/net7.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbRowUpdatedEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Data.OleDb.dll</Left>
<Right>lib/net7.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbRowUpdatingEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Data.OleDb.dll</Left>
<Right>lib/net7.0/System.Data.OleDb.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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.Diagnostics.SampleActivity`1.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Diagnostics.DiagnosticSource.dll</Left>
<Right>lib/net7.0/System.Diagnostics.DiagnosticSource.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Diagnostics.DistributedContextPropagator.PropagatorGetterCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Diagnostics.DiagnosticSource.dll</Left>
<Right>lib/net7.0/System.Diagnostics.DiagnosticSource.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Diagnostics.DistributedContextPropagator.PropagatorSetterCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Diagnostics.DiagnosticSource.dll</Left>
<Right>lib/net7.0/System.Diagnostics.DiagnosticSource.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Diagnostics.Metrics.MeasurementCallback`1.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Diagnostics.DiagnosticSource.dll</Left>
<Right>lib/net7.0/System.Diagnostics.DiagnosticSource.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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.Diagnostics.EntryWrittenEventHandler.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.Diagnostics.EventLog.dll</Left>
<Right>lib/net7.0/System.Diagnostics.EventLog.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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.Diagnostics.ICollectData.CollectData(System.Int32,System.IntPtr,System.IntPtr,System.Int32,System.IntPtr@)</Target>
<Left>lib/net6.0/System.Diagnostics.PerformanceCounter.dll</Left>
<Right>lib/net7.0/System.Diagnostics.PerformanceCounter.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:System.Diagnostics.ICollectData.CollectData(System.Int32,System.IntPtr,System.IntPtr,System.Int32,System.IntPtr@)</Target>
<Left>lib/net6.0/System.Diagnostics.PerformanceCounter.dll</Left>
<Right>lib/net7.0/System.Diagnostics.PerformanceCounter.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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.DirectoryServices.Protocols.DereferenceConnectionCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.DirectoryServices.Protocols.dll</Left>
<Right>lib/net7.0/System.DirectoryServices.Protocols.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.DirectoryServices.Protocols.NotifyOfNewConnectionCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.DirectoryServices.Protocols.dll</Left>
<Right>lib/net7.0/System.DirectoryServices.Protocols.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.DirectoryServices.Protocols.QueryClientCertificateCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.DirectoryServices.Protocols.dll</Left>
<Right>lib/net7.0/System.DirectoryServices.Protocols.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.DirectoryServices.Protocols.QueryForConnectionCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.DirectoryServices.Protocols.dll</Left>
<Right>lib/net7.0/System.DirectoryServices.Protocols.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.DirectoryServices.Protocols.VerifyServerCertificateCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.DirectoryServices.Protocols.dll</Left>
<Right>lib/net7.0/System.DirectoryServices.Protocols.dll</Right>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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.DirectoryServices.ActiveDirectory.SyncUpdateCallback.#ctor(System.Object,System.IntPtr)</Target>
<Left>lib/net6.0/System.DirectoryServices.dll</Left>
<Right>lib/net7.0/System.DirectoryServices.dll</Right>
</Suppression>
</Suppressions>
Loading

0 comments on commit 7626c5d

Please sign in to comment.