-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix: Unsupported maccatalyst attribute is getting applied to child attributes but not accounted parent child attributes merge #50334
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
base: main
Are you sure you want to change the base?
Conversation
…tributes but not accounted parent child attributes merge
…t can be handled same as other platforms
CC @buyaa-n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where unsupported MacCatalyst attributes applied to child methods were not properly accounted for when merging with parent attributes. The issue occurred because iOS implicitly supports MacCatalyst, but when [UnsupportedOSPlatform("maccatalyst")]
is explicitly added to remove this implicit support, the merge logic wasn't preserving this unsupported status.
- Fixed merge logic to properly handle unsupported platform attributes during parent-child attribute merging
- Added condition to check if attributes are set before determining deny list status
- Restructured conditional logic for better handling of supported version boundaries
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
PlatformCompatibilityAnalyzer.cs | Fixed merge logic for platform attributes and updated deny list condition |
PlatformCompatibilityAnalyzerTests.cs | Added comprehensive test cases to verify the fix works correctly |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
...is.NetAnalyzers/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
....UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzerTests.cs
Outdated
Show resolved
Hide resolved
…alysis.NetAnalyzers.UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzerTests.cs Co-authored-by: Viktor Hofer <[email protected]>
@ViktorHofer is anything else needed here to get it approved and merged? |
…ysis.NetAnalyzers/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs Co-authored-by: Copilot <[email protected]>
When an API supported on IOS it also supported by maccatalyst as they are related. To remove implicit maccatalyst support one need to add
[UnsupportedOSPlatform (""maccatalyst"")]
to the[SupportedOSPlatform (""ios"")]
The
[UnsupportedOSPlatform (""maccatalyst"")]
applied to the immediate (child) attributes list and removed the implicit maccatalyst support but when child attributes are merged to the parent attributes list this is not accounted and merged list will keep the implicit maccatalyst support. The PR fixes this bug.Fixes #50337
This is a re-creation of this pull request from dotnet/roslyn-analyzers: dotnet/roslyn-analyzers#7644