Fix: Unsupported maccatalyst attribute is getting applied to child attributes but not accounted parent child attributes merge#50334
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.
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.
…alysis.NetAnalyzers.UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzerTests.cs Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
|
@ViktorHofer is anything else needed here to get it approved and merged? |
…ysis.NetAnalyzers/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@dotnet/dotnet-analyzers PTAL |
|
@dotnet/dotnet-analyzers anything I can do to push this along? |
|
@dotnet/dotnet-analyzers this pull request is green now, could someone please review so it can get merged? It's been almost a year... |
|
Due to lack of recent activity, this PR has been labeled as 'Stale'. It will be closed if no further activity occurs within 7 more days. Any new comment will remove the label. |
|
This PR is not stale, it's just waiting for a review/approval. |
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