Consistency: Chains a call to NotNull
See original GitHub issueIn all of the other methods that validate the parameter is not null, we’re explicitly testing if (value is null)
with a comment that reads
// To whoever is doing random code cleaning:
// Consider the performance when changing the code to delegate to NotNull.
// In general do not chain call to another function, check first and return as earlier as possible.
However, in Requires.NotNullOrEmpty
we don’t do that and instead, call NotNull
. Should we change this so it’s consistent?
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
C# null check chain in method call
Starting with C# 6.0 you can use Null-Conditional Operator, which lets you make null-checking implicitly: var result = possiblyNull?
Read more >Releases · AArnott/Validation
#45: Consistency: Chains a call to NotNull; #48: Replaces the single-iteration foreach loops. This list of changes was auto generated.
Read more >Fetching a value without having to null check in Java
I think it is better to know where exactly the chain is broken than to silently get a null that could be hiding...
Read more >`foo?.bar.yolo.stop()` - Mixed Nullable & Non- ...
Finding the first question mark in the call chain is easy, but it requires me to continuously scan call chains for question marks....
Read more >Consistent gets growth fast when running FLASHBACK QUERY
Hi all! I have running a simple flashback version query on table and query completes after 2 or 3 hours and requires too...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can change them to call
NotNull
and add aThrowHelper
.I don’t know how to validate what the JIT inlines, though, short of looking at the compiled code in something like JustDecompile…or is that what you’re thinking of?
I’ll submit a separate PR for this, and then once it gets approved will submit one to vs-validation. That way, any changes that might be needed can be done here first and the PR to vs-validation ends up being cleaner.
Nice. I didn’t know the ETW events included explanations. I’ll have to check that out.