-
Notifications
You must be signed in to change notification settings - Fork 457
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
Support for Property getter/setter and event add/remove annotations #4074
Conversation
I would wait for @mavasani to review this before merging |
.../UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzerTests.cs
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## release/dotnet5-rc1 #4074 +/- ##
=======================================================
- Coverage 95.53% 95.51% -0.03%
=======================================================
Files 1159 1160 +1
Lines 260997 261358 +361
Branches 15649 15699 +50
=======================================================
+ Hits 249352 249635 +283
- Misses 9669 9743 +74
- Partials 1976 1980 +4 |
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
.../UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzerTests.cs
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Show resolved
Hide resolved
.../UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzerTests.cs
Outdated
Show resolved
Hide resolved
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.
Some minor suggestions, but otherwise LGTM. I think you may want to tweak the nameof case to use the property symbol instead of the getter.
What gets emitted in the diagnostic for the name of the API? Ideally, we would match the behavior of the
|
Display name is handling only C# similarly (well we are using c# option |
I actually prefer our current approach of using the similar display name for VB and C#, we strive very hard to not have different error messages between languages for same issue. I’d say it is in fact a compiler issue that messages are not similar for obsolete diagnostics between languages. |
Ok, cool. So long as it's deliberate and the property accessor names are friendly like |
Note that it is fine to use VB error message format for VB and C# error message format for C#. You can tweak that part easily in your ReportDiagnostics method by switching on IOperation.LanguageName. Let’s still try to use the same resources string for C# and VB so the message appears similar to user, but just with correct VB and C# terminology. |
JFYI: Messages looks in C# like: In VB: |
@buyaa-n Above messages are when both languages use |
we don't have any path for VB, so they both using C# |
Thanks, can you try changing it to use C#/VB short error message format based on IOperation.Language and see the message? |
Sure, about to do that, didn't know it was so easy 😛 |
Now VB looks like |
I recommend we go ahead and merge this in and then have @jmarolf proceed with getting the new build integrated into the SDK. |
The bug fix for Event accessor is coming, I am about to push i guess we want ti fixed, hope there is time for review |
Event accessors added, @mavasani final round review, please 🙏 |
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatabilityAnalyzer.cs
Show resolved
Hide resolved
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.
Small nits, but overall LGTM!
I've done manual testing with this branch and property getters and setters as well as event add/remove methods are all working as expected. 💯 |
Fixes #4071 Attributes are not respected on property getters/setters
Fixes #4072 Attributes are not respected on event add/remove methods
Copied IOperation Extensions method from roslyn and used it for determining if Read or Write operation taken place
CC @jmarolf @mavasani @jeffhandley @terrajobst