.Net 5 Freakin Annoying
-
It's screaming about a bunch of warnings that didn't crop up in .Net Framework. CS8600, 8601, 8602, and 8618. I see no benefit when the objects it's screaming about can in fact be null without hurting anything. In fact, my code is written to handle it gracefully. Nanny state bullsh|t...
".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, 2013Disable explicit nullability, problem solved. If explicit nullability is your problem in the first place. If you don't know whether an object you just got passed to your function can be null, you have to program more defensively, than if you know it'll never be null (in that case, it'd get caught by the runtime if you declare this parameter as explicitly-not-null). Explicit nullability is one of those correctness features which you may just as well dread if you're not used to having a compiler look at your work, but is rather helpful once you learn to let the compiler do your job. If an object can, in fact, be null, then declare it as nullable. I got a plethora of both Object and Object? members in my current work project, those that can be null during error-free operation, are declared Object?, those that can't, are declared without the ? as I want the runtime to throw an error in an error case.
-
And that's why instead of renewing my 14 years old knowledge of C# I decided to send MS to the Hell they belong and move to Python for my RAD activities. For all my other activities C++ is the pinnacle of high level but usually only C is viable, and Assembler becomes a not unreasonable tool.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
Python? Aww, that is nice nest of hornets, if some external boundaries are enforced (like only using a version supported by the official repo of your distro) Good luck finding out what works how in 3.7, 3.9, 3.10.
-
I disagree with this sentiment. I think that the way a variable is declared is very important to allow the compiler to check for misuse. Any misuse found would indicate that the programmer means something other than what he wrote.
The difficult we do right away... ...the impossible takes slightly longer.
Either you misunderstood what I wrote, or I misunderstood you :confused: With nullable:
object? obj;
object obj;clearly indicate if "null" is an expected value. The "null" state is very useful - but also a very special - state, so these declarations allow the developer to clearly express if the null state is (or can be) used or not. Without nullable
object? obj;
covers both cases and the compiler has no way to help checking for what you refer to as misuse. Your first sentence indicates you disagree with this, but then the rest says the opposite?
-
I disagree, even an expert brain farts sometimes and the compiler warning you of that is, to me, useful to avoid bugs. And having the warnings in place can help in shared codebases, if you work alone sure, disable them. If it's shared I much prefer having them enabled and when you do weird stuff you disable it with a comment right there and not globally
I love Delphi 7's warnings of using platform-specific code - especially in the hindsight of how successful Delphi was on Linux and on .net.
-
Python? Aww, that is nice nest of hornets, if some external boundaries are enforced (like only using a version supported by the official repo of your distro) Good luck finding out what works how in 3.7, 3.9, 3.10.
Peter Adam wrote:
Good luck finding out what works how in 3.7, 3.9, 3.10.
Yrah it's a fast cycle VB, it's the VB3->VB4->VB5->VB6 transitions all over again. Though with mostly windows workstation or prepackaged runtimes for Linux it can be used without issues. It does require a process, that's for sure. Which is fine, in automotive we love processes and SPICEs.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
Disable explicit nullability, problem solved. If explicit nullability is your problem in the first place. If you don't know whether an object you just got passed to your function can be null, you have to program more defensively, than if you know it'll never be null (in that case, it'd get caught by the runtime if you declare this parameter as explicitly-not-null). Explicit nullability is one of those correctness features which you may just as well dread if you're not used to having a compiler look at your work, but is rather helpful once you learn to let the compiler do your job. If an object can, in fact, be null, then declare it as nullable. I got a plethora of both Object and Object? members in my current work project, those that can be null during error-free operation, are declared Object?, those that can't, are declared without the ? as I want the runtime to throw an error in an error case.
Yeah, and in my original message, I stated that I did that. The code I was trying to convert has been around for 10 years, and has been working flawlessly the entire time. I've already done the defensive coding that's needed. I've been coding for over 40 years. I think I know pretty much how to do this stuff. And making an object nullable doesn't mean you don't still have to check it before using it, so you gain nothing at all by making it nullable in terms of how much code you have to write.
".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 -
It's screaming about a bunch of warnings that didn't crop up in .Net Framework. CS8600, 8601, 8602, and 8618. I see no benefit when the objects it's screaming about can in fact be null without hurting anything. In fact, my code is written to handle it gracefully. Nanny state bullsh|t...
".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, 2013this 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.
-
Yeah, and in my original message, I stated that I did that. The code I was trying to convert has been around for 10 years, and has been working flawlessly the entire time. I've already done the defensive coding that's needed. I've been coding for over 40 years. I think I know pretty much how to do this stuff. And making an object nullable doesn't mean you don't still have to check it before using it, so you gain nothing at all by making it nullable in terms of how much code you have to write.
".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, 2013You don't have to check by making an object non-nullable. Suppose, I have a function Decode(List Buffer), not Decode(List? 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? (or List 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.
-
I'd have thought it was more annoying that .NET 5 is only supported until May: Microsoft .NET and .NET Core - Microsoft Lifecycle | Microsoft Docs[^] The current "long-term support" version is .NET 6, which is supported until ... November 2024[^]. Turns out not having to rewrite everything every three years is yet another bonus to sticking with .NET Framework 4.8.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
What is truly annoying about .NET 5 only supported until May is that projects targeting .NET 6 are not supported in VS2019, so not only do you have to upgrade projects to .NET 6 you have to upgrade environments to VS2022 to work with those projects.
-
It's screaming about a bunch of warnings that didn't crop up in .Net Framework. CS8600, 8601, 8602, and 8618. I see no benefit when the objects it's screaming about can in fact be null without hurting anything. In fact, my code is written to handle it gracefully. Nanny state bullsh|t...
".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, 2013You're looking to add
disable
To a PropertyGroup in your .csproj. You may also want to add the following, since you would already have the usings you want:
disable
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 :confused: 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. - Alan Watts https://www.youtube.com/watch?v=-gXTZM\_uPMY
-
I'd have thought it was more annoying that .NET 5 is only supported until May: Microsoft .NET and .NET Core - Microsoft Lifecycle | Microsoft Docs[^] The current "long-term support" version is .NET 6, which is supported until ... November 2024[^]. Turns out not having to rewrite everything every three years is yet another bonus to sticking with .NET Framework 4.8.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I have been sticking with .NET 4.6 since that is the framework I have been developing my current project in. When I started the project, WPF wasn't fully supported in the new .NET frameworks. No problems at all and I still have access to all that "legacy" technology that disappeared with the new .NET Core Frameworks...
Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com
-
It's screaming about a bunch of warnings that didn't crop up in .Net Framework. CS8600, 8601, 8602, and 8618. I see no benefit when the objects it's screaming about can in fact be null without hurting anything. In fact, my code is written to handle it gracefully. Nanny state bullsh|t...
".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, 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 -
You're looking to add
disable
To a PropertyGroup in your .csproj. You may also want to add the following, since you would already have the usings you want:
disable
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 :confused: 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. - Alan Watts https://www.youtube.com/watch?v=-gXTZM\_uPMY
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 -
I have been sticking with .NET 4.6 since that is the framework I have been developing my current project in. When I started the project, WPF wasn't fully supported in the new .NET frameworks. No problems at all and I still have access to all that "legacy" technology that disappeared with the new .NET Core Frameworks...
Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com
I typically use .Net 4.7, but in this instance, I was curious about Avalonia and writing a cross-platform app, so I am trying to convert a 10-year-old WPF app to it, and in the process, I chose to use .net 5.0. Avalonia is even more infuriating than .Net5. I went in thinking it was a "better wpf than wpf", but there are a seemingly infinite number of things that it does differently (for instance, instead of having the
Visibility
attribute, it'sIsVisible
, which broke a moderate amount of XAML and viewmodels). Many of the same WPF principles apply, but there are enough differences that an experienced WPF dev will be tearing their hair out trying to get it to work.".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 -
I typically use .Net 4.7, but in this instance, I was curious about Avalonia and writing a cross-platform app, so I am trying to convert a 10-year-old WPF app to it, and in the process, I chose to use .net 5.0. Avalonia is even more infuriating than .Net5. I went in thinking it was a "better wpf than wpf", but there are a seemingly infinite number of things that it does differently (for instance, instead of having the
Visibility
attribute, it'sIsVisible
, which broke a moderate amount of XAML and viewmodels). Many of the same WPF principles apply, but there are enough differences that an experienced WPF dev will be tearing their hair out trying to get it to work.".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, 2013I understand your pain... The only thing I am interested with the new .NET Core Frameworks is Blazor Server-Side. It appears to be a return to WebForms with a twist, which I have been predicting for years... :)
Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com
-
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