|
You don't have to check by making an object non-nullable. Suppose, I have a function Decode(List<byte> Buffer), not Decode(List<byte>? Buffer). Well, the moment a null gets passed to this function, the runtime throws an exception. I don't have to check anything in the function, the runtime does for me. More importantly, it throws at the exact point where a null gets converted to a can't-be-null, when taking a List<byte>? (or List<byte> with nullable disabled), any point in my function using this object can throw and depending on how the code is written, the crash stack trace may or may not end up a gordian knot to debug. With nullable, the stack trace is clear.
|
|
|
|
|
this will come out not in the way I might intended but,
just because it has been working for 20 years, does not mean I couldn't be reviewed, improved or changed.
I had this on some code last month. some simple method, was confused by this new warning, but helped learned how there another way to write the code (for what ever .net compiler developer has decided it should be written their way)
I don't like it, looks off, maybe ill come to shifting thinking, but hopefully for that set of developers that have yet to have the whole system fail over because of 1 null check missing in that 1 very very important, one of a kind situation, that this warning helps mitigate for them until they leave the project and is someone else problem then.
|
|
|
|
|
You're looking to add
<Nullable>disable</Nullable>
To a PropertyGroup in your .csproj. You may also want to add the following, since you would already have the usings you want:
<ImplicitUsings>disable</ImplicitUsings>
Nullables kinda make sense because people get silly around the value null , so you can use this feature to get the compiler to do null checks instead of doing them yourself - but I turn this off because otherwise it warns in a lot of places where I'm already considering that. Implicit usings, imo, may make the code seem to be a little more convenient, but then hide the dependencies of the code - and will add in dependencies that you're not using, which is really annoying if you use something like ReSharper to import an unknown type with alt-enter and there happens to be a same-named type in the implicit imports
You may also check out dotnet 6, since you're upgrading, and 6 is already RTM.
------------------------------------------------
If you say that getting the money
is the most important thing
You will spend your life
completely wasting your time
You will be doing things
you don't like doing
In order to go on living
That is, to go on doing things
you don't like doing
Which is stupid.
|
|
|
|
|
Davyd McColl wrote: Nullables kinda make sense because people get silly around the value null, so you can use this feature to get the compiler to do null checks instead of doing them yourself - but I turn this off because otherwise it warns in a lot of places where I'm already considering that.
I do that too. I already handle the null checks, and just because something is nullable doesn't mean you can just willy-nilly use objects without null checking before hand.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Dude a quick Google search will show you that it can be easily disabled.
|
|
|
|
|
Dude, go back and re-read my original message. I've already done that. It was freakin annoying to have to, which is the entire point of my rant.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
This forum kinda sucks as its hard to see context. Sorry if I missed something.
|
|
|
|
|
If so what Star System would best fit?
I personally think the TRAPPIST-1 System would best fit, just the distance is the problem...
|
|
|
|
|
Yes, I do think it's possible, except they come from far and they've colonized this planet.
Or would you have me believe customers are from planet Earth (or even this solar system)?
|
|
|
|
|
Customers are from the B ark.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
I am sure we will all die from some horrible disease transmitted by (mobile) phone.
|
|
|
|
|
If I recall correctly the TRAPPIST-1 system has two or three good candidates, if you're looking for one with a gravity similar to earth.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
Not only that, the system itself is small enough that colonists of each of the three planets could trade with current technology...
They are that close together...
|
|
|
|
|
Possible doesn't imply feasible.
|
|
|
|
|
Feasible doesn't mean feasible in the next few decades.
|
|
|
|
|
IMHO - Its highly doubtful that humans survive long enough to develop the necessary technologies.
|
|
|
|
|
Agreed.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
We only need a new Captain Kirk and a new Enterprise with Warp 10 or 12
|
|
|
|
|
|
I am fairly certain the rest of the cosmos does not want the human species leaving this planet to mess up other planets.
We are a fairly efficient parasitic species, destroying everything in our path.
|
|
|
|
|
sad but true
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Amateurs. Have not even taken apart a few solar systems for a single dyson sphere yet, but already thinking that they are real gangstas.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
If there is intelligent life out there, I bet they are just as screwed up as we are!
Hogan
|
|
|
|
|
snorkie wrote: intelligent life
Are we really intelligent though? Or, are we just in the habit of inflating our already gigantic egos?
I don't think we are as intelligent as we let on.
|
|
|
|
|
Quote: If
"Surely you're joking Mr. Feynman" . There are countless galaxies each w/ countless stars . And as Mr. Art Bell knew well , they are already here among us . - Cheerios
PS As an aside a bit off topic may I say I consider Mr. Musk's plan to colonize Mars stupid . How those people will tolerate being cooped up for a one-way 6 month journey sure to not survive very long upon colonization and pity the child born I have no idea .
PPS Prior to colonizing we have to master gravity . That might take a century or two . - Cheerio
|
|
|
|