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

Public API Analyzer considers IntPtrs in CS as nints resulting in RS0017 #6059

Open
Tanya-Solyanik opened this issue Jul 11, 2022 · 0 comments

Comments

@Tanya-Solyanik
Copy link
Member

Analyzer

Diagnostic ID: RS0017: Symbol is part of the declared API, but is either not public or could not be found

Analyzer source

SDK: Built-in CA analyzers in .NET 7 SDK or later

Version: SDK 7.0.100-preview.5.22307.18 - the latest Arcade

Describe the bug

CI build failure in winforms repo: https://github.com/dotnet/winforms/pull/7376/checks?check_run_id=7263703283
src\System.Windows.Forms.Primitives\src\System\Windows\Forms\Message.cs#L31
src\System.Windows.Forms.Primitives\src\System\Windows\Forms\Message.cs(31,30): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'HWnd.get' is not part of the declared API.

These errors are generated for code like this:
public IntPtr HWnd { get; set; }

because the current API is declared in PublicApi.Shipped.txt like this:
System.Windows.Forms.Message.HWnd.get -> IntPtr
but the analyzer expects:
System.Windows.Forms.Message.HWnd.get -> nint

Potentially related to: dotnet/csharplang#6065

Steps To Reproduce

See build failures in the dependency flow PR

Expected behavior

Public APIs that use IntPtr types should not be flagged as changed due to compiler change

Actual behavior

Build break

Additional context

jaredpar pushed a commit to jaredpar/roslyn that referenced this issue Apr 11, 2023
Fix
Work around a bug in the public API analyzer

dotnet/roslyn-analyzers#6059
jaredpar pushed a commit to dotnet/roslyn that referenced this issue Apr 13, 2023
* Source build fixes

The source build produced from our official build needs to include both
the net7.0 and net8.0 packages. Those packages feed into the soucre
build legs of other repos and they can be targeting either net7.0 or
net8.0.

* fixes

* Fix

Work around a bug in the public API analyzer

dotnet/roslyn-analyzers#6059

* nint

* fix package

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants