-
Notifications
You must be signed in to change notification settings - Fork 4k
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
IDE0044 (Add readonly modifier) false positive #47197
Comments
@AlekseyTs Would you be able to give a look here? |
|
@AlekseyTs Thanks. Can you switch to Area-IDE to fix the false positive of IDE0044? |
@Youssef1313 I'm not clear what the issue is that you are reporting. Can you clarify? |
@CyrusNajmabadi Simply, see the suppression in: roslyn/src/Compilers/VisualBasic/Portable/Symbols/Source/OverrideHidingHelper.vb Lines 584 to 586 in eb26ee3
IDE0044 shouldn't have been reported in this case based on @AlekseyTs comment. |
Could you flesh out the OP more. It wasn't clear waht this was talkign about, and it needed many jumps to otehr bugs and PRs to even get a sense of what might be going on. |
@CyrusNajmabadi Sure. Done. |
I can't seem to repro this issue in a small example: Sharplab Compiler seems fine with:
I do get the error if i make the constructor non-shared. But in the original example, the constructor is shared, so i'm not sure why there's a problem inside roslyn, but not in the repro case. |
@AlekseyTs do you know why teh above sharplab link shows no issues? i can't figure out the importance difference between it, and the code actually in OverrideHidingHelper. Thanks! |
Is SharpLab supposed to run analyzers? |
No. :) What i was trying to show in my sharplab example was that i get no error for assigning to this readonly field in the trimmed down code example. But if you make the field readonly in roslyn itself, you get:
What i cannot figure out is how the code in roslyn is meaningfully different from teh sample code. Clearly in roslyn itself something about the code is triggering the error, i just cannot tell what it is. I thought it was the assignment to the field through a different instantiation. But clearly that's ok in sharplab. So it's currently unclear to me what's up :) |
By default, we duplicate a bug in native compiler. There is a switch to overcome that,
Observed:
|
Obviously we compile compiler with the "strict" flag |
oh.... it's a strict "feature flag" thing. Interesting. Thanks very much for the clarification. I def didn't realize that. |
Ignore my above post. You answered it :) |
UPDATED:
roslyn/src/Compilers/VisualBasic/Portable/Symbols/Source/OverrideHidingHelper.vb
Lines 584 to 586 in eb26ee3
IDE0044 shouldn't have been reported in this case. (See #47197 (comment))
The text was updated successfully, but these errors were encountered: