-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Microsoft.Dotnet.Compatibility analyzer doesn't work with the NumericIntPtr feature #25566
Comments
This may automatically get fixed when the SDK picks up a compiler version with this feature, but it would be good to have explicit tests/validation that this is correctly handled. Once there is analyzer with the fix then dotnet/runtime should have its |
Spoke with @tannergooding about this offline recently and here's our discussion dump. I think we want to refine the
|
@tannergooding is the same true for method signatures and interface implementations? If I define an method as |
Other languages will just see The only real difference is the members exposed by each. Prior to .NET 7, For .NET 7 and later (or more specifically, any runtime that defines |
I see. When we have references provided does roslyn see the net6 |
I'm not sure how that's surfaced when there isn't a |
If |
When comparing .NET 6 reference assemblies against .NET 7 reference assemblies, I see 1127 differences being logged because of this issue. This is noise that customers might experience as well and thus I think we should fix this in the .NET 7 timeframe. I don't know yet what a fix would look like. Presumably ignoring the difference in the equality symbol comparer makes most sense. |
@ericstj, there is no API currently for indicating that One consideration is that such an API would affect sharing of symbols across compilations in the compiler. |
I see. In this case we aren't doing any compilation, but instead using Roslyn to analyze binaries it previously produced. We're trying to do so with minimal ceremony around reconstructing the parameters to the compiler (like references). I think if Roslyn had encoded the feature flags it used when compiling the assembly, it could reverse the metadata back to |
Previously, ApiCompat would consider `IntPtr` and `nint` (as well as `UIntPtr` and `nuint`) as different types, emitting diagnostics where there shouldn't have been. This change updates the display string used by the SymbolComparer to replace all instances of `IntPtr` with `nint` and `UIntPtr` with `nuint`. Fixes #25566
Previously, ApiCompat would consider `IntPtr` and `nint` (as well as `UIntPtr` and `nuint`) as different types, emitting diagnostics where there shouldn't have been. This change updates the display string used by the SymbolComparer to replace all instances of `IntPtr` with `nint` and `UIntPtr` with `nuint`. Fixes dotnet#25566
dotnet/runtime#69627 updated the dotnet/runtime repo to utilize the
NumericIntPtr
feature from C# 11: dotnet/csharplang#6065This resulted in the compatibility analyzer misfiring with many errors such as:
This is despite the underlying assemblies still containing the correct signatures. I noticed the version was out of date and so grabbed the latest package available, 2.0.0-preview.4.22252.4, to see the same error.
The text was updated successfully, but these errors were encountered: