-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use Assumes.Present instead of Debug.Assert #28556
Conversation
@sharwell How do we want to reconcile this with Contract.ThrowIfNull() that we probably also use in a few places? |
@jasonmalinowski I was repeatedly hitting these assertions under an unknown deployment configuration and the resulting modal dialogs were causing problems for some tests. |
@sharwell: so guidance going forward would be Assumes.Present for services in VS layer, and for everything else do as you have previously done? Want to do a pass to see if there is a bunch of other ones we can clean up too? |
We currently reference |
The assertion test issue was resolved by #33600. @jasonmalinowski do you have any interest in us pursuing unification of these checks? |
@sharwell If you want to merge this PR I'm fine with it...I'm not sure I'd send time fixing up other places though. I'd also expect that with C# nullable coming we'd have some new GetService() method anyways that returns explicitly non-null which would moot this pattern. |
Assumes.Present produces a more informative exception and message on failure.
16e462a
to
d3ff068
Compare
Assumes.Present
produces a more informative exception and message on failure.Closes #34329
Ask Mode template not completed
Customer scenario
What does the customer do to get into this situation, and why do we think this
is common enough to address for this release. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)
Bugs this fixes
(either VSO or GitHub links)
Workarounds, if any
Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW
Risk
This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code
Performance impact
(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")
Is this a regression from a previous update?
Root cause analysis
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
(E.g. customer reported it vs. ad hoc testing)
Test documentation updated?
If this is a new non-compiler feature or a significant improvement to an existing feature, update https://github.com/dotnet/roslyn/wiki/Manual-Testing once you know which release it is targeting.