-
Notifications
You must be signed in to change notification settings - Fork 128
Analyzer warns when Requires... Attribute is on a static constructor #2455
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2ff076e
Init for adding analyzer support to warn on Requires on cctor
jtschuster 500a542
Adds an ExpectedWarning for IL3051 to DerivedClassWithAllWarnings
jtschuster c35ab2b
Update test to expect RAF and RDC on cctor warnings in analyzer only
jtschuster f9c57ee
Revert Cecil version Change
jtschuster db0084b
Add a visit to ConstructorDeclaration in syntax walker test infra
jtschuster e781898
Test case for ExpectWarning not working as expected in analyzer tests
jtschuster 0835e40
Adds warning on static constructors to analyzers
jtschuster b95fc44
Remove RequiresDynamicCode ExpectedWarnings
jtschuster 7c03ea5
reset Cecil to correct version
jtschuster 645cee2
Renumber diagnostic IDs, use Roslyn member notation instead of IL not…
jtschuster a19ffb6
remove ..cctor from static constructor diagnostic messages
jtschuster da05d3f
uses 'static' modifiers in cctor diagnostic messages
jtschuster 04270d6
uses ..cctor() notation in diagnostic messages
jtschuster 2425bb2
Add test for ExpectedWarning on ctor and cctor
jtschuster 54dbedc
Fix formatting
jtschuster cb9fc19
Accomodate for potential bug found in linker
jtschuster aa720df
fix shared string formatting
jtschuster b26e96a
Remove extra line in DiagnosticId.cs
jtschuster e6eb758
References the new test class in the test code so it's not trimmed
jtschuster 66f39a8
Merge branch 'RequiresOnCctorWarns' of https://github.com/jtschuster/…
jtschuster c78a81a
Fix formatting
jtschuster 011dcd2
Merge with main
jtschuster 46f0c68
update cecil and fix extra line
jtschuster 6bdad7a
Remove extra comma in DiagnosticId.cs
jtschuster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Fix for #2446 to make sure we account for ExpectedWarning on constructors.
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.
Can you add a test for this? Something that Inside the static constructor calls a method annotated with RUC and just verify that we can use the ExpectedWarning attribute
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.
Good thing you mentioned this, I think I found a bug that the linker doesn't check in constructors for calls to methods with RUC. The test class for this is
WarningsInCtorin RequiresCapability.cs. It calls a method annotated with RUC inside the constructors, but the linker doesn't seem to be producing a warning. I filed #2484 to track the issue.Uh oh!
There was an error while loading. Please reload this page.
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.
I think it's because nothing references that code in the main method, since it's not referenced Trimmer will get rid of that piece of code. Notice that one of the differences between analyzer and trimmer is that analyzer will produce diagnostics even for code that will be trimmed.