Live data from Hacker News

.NET 5.0

devblogs.microsoft.com

211–220 of 466 posts

Re: .NET 5.0

#211

Does anybody knows if .NET 5.0 will be included in Windows as a Windows Update as the .NET Framework ?

It won't be. .NET Framework is an embedded component of Windows. .NET Core is something apps have to package along with them. (Due to this, .NET Core apps are larger than .NET Framework apps, but tend to have less compatibility issues in theory, since they bring everything they need with them.)

It also means that the first major vulnerability in .NET Core will be an unmitigated clusterfuck, as admins will have no automated tooling in place to update .NET Core with security patches.

"Just recompile with the new version!" I hear the cries already, said by people that have never had to support literally a thousand applications in a government data centre, half of which were built years ago by a vendor that is long since bankrupt.

Re: .NET 5.0

#212

Earlier quoted context omitted.

>20x times shorter that's giant, but I don't think that "just" language / environment difference makes this huge difference

I would say 2x-5x shorter is pretty realistic.

yeah javascript is pretty short. unfortunatly I do not know how people love it. npm/yarn and javascript dependency management is the worst thing i've ever seen and it is slow and pulls in millions of files, just for a small project.

Re: .NET 5.0

#213

Earlier quoted context omitted.

Can't you just ignore the built in configuration and roll your own (probably there's a dotenv library?). That said, I've also personally moved away from C# despite really likeing the lanaguage due to a lacking ecosystem. I'd recommend both node with TypeScript and Rust for backend web development in a statically typed langauge.

We started to use F# with Elm and it works very well. Statically typed all the way.

This year I converted a standard F#+Giraffe backend and React+Typescript frontend to use Feliz [0] with Fable.Remoting [1] and it has been a pleasant experience.

[0] https://github.com/Zaid-Ajaj/Feliz

[1] https://github.com/Zaid-Ajaj/Fable.Remoting

Re: .NET 5.0

#214

So, on the plus side with the new .net, I recently made a .net core web app on Linux, and generally it's been pretty easy. I'm also impressed at just how fast asp.net core is compared to asp.net, the time it takes to open your site in debug mode has dropped dramatically, from what used to be 1/2 minute in asp.net to a few seconds in .net core. On the bad side? Mainly the asp.net core team and their push for Dependenc…

Yeah, the DI stuff is a lot, but eventually bringing in the dependencies becomes total autopilot.

> I've given up with the config DI and just assign them all to static variables.

Not to be a fanboy, but it's designed in a way where you CAN use all the fancy features. If you want something simpler, you can just do exactly what you did.

This syntax is probably wrong because I'm doing this from memory, you should probably also use the Lazy class or something, and if I were to actually write this code I'd think twice about thread safety -- but if you want simple static access to config values, you can just do this:

public static MyConfigPoco MyConfig {get;set;} = JsonConvert.DeserializeObject(File.ReadAllLines("appsettings.json")) ;

Re: .NET 5.0

#215

Earlier quoted context omitted.

If I wrote a F# codebase at a lot of companies I would find myself swiftly booted out the door.

Oh yes you'd definitely get booted for using F# in a C# shop. I love F# but would never use it at my current job because nobody else on my team knows anything about FP, even though the language itself can be learned in about a week since it's so simple.

My comment was a glib comment and wasn't supposed to be taken too seriously.

Re: .NET 5.0

#216

Earlier quoted context omitted.

I agree. The first thing I always do is make a custom Settings class which just loads settings via good old `Environment.GetEnvironmentVariable`. Super simple and never failed me. Bonus Points, by loading all settings at once into strongly typed properties at startup, it will fail fast if a setting is missing, which to me is a benefit. But I still pass this class via DI to the controllers for testability reasons. If…

>I agree. The first thing I always do is make a custom Settings class which just loads settings via good old `Environment.GetEnvironmentVariable`. Super simple and never failed me. The .net core configuration mechanism has a hierarchy of providers it reads from, one of which is environment variables, and strongly typed configuration is supported out of the box, so you're exact use case is supported natively by it.

I am aware of this, but like many other, I find the IOptions a bad abstraction.

This blog has similar thoughts: https://rimdev.io/strongly-typed-configuration-settings-in-a...

or this blog: https://adamstorr.azurewebsites.net/blog/beyond-basics-aspne...

Or simply google 'asp net strongly typed configuration' and notice everyone seems to be reaching similar conclusions and building their own things.

Just load the setting yourself and register it as a singleton.

Re: .NET 5.0

#217
post #192

Earlier quoted context omitted.

How does async/await introduce complexity where threading wouldn’t? In my experience, the complexity is vastly reduced by not having to implement tricky asynchronous APIs (Task Paralell, thread pools, BackgroundWorker, etc).

no, vs blocking the UI thread. Which is perfectly fine the vast majority of the cases, unless you are running something long running.

You are trying to something slightly complex. I don't see how one could make it any easier from a language design perspective and staying idiomatic to the language.

Go: Goroutines make you wire the "stop" scenario on your own (channel close). Rust: Hold on to your future and drop() it. C#: Pass a cancellation token and call Cancel()

All seem reasonable and stay within what they think their developers will be able to pick up and run with.

Re: .NET 5.0

#218
post #82

Earlier quoted context omitted.

.NET is meant for stuff like microservices; you don't see lots of those written in php, right? Also, for high-traffic websites, that's really not a great idea. You might say "but Facebook, PHP" - I'm really certain that their current codebase doesn't have a thread that blocks on DB for each user request.

> .NET is meant for stuff like microservices; What does this mean? .NET has been around before SOA was a term and microservices is an evolution of that. The concepts are orthogonal and you could write microservices in PHP, if you really wanted. Like Java, the .NET runtime and platform is highly efficient. That's what .NET has historically had over PHP/Python/Ruby, but I don't keep up with the PHP and Ruby platforms t…

I'm not sure where SOA as a specific term showed up, but the very first release of .NET very much emphasized web services in the docs, presentations etc. Back then, this meant SOAP.

Re: .NET 5.0

#219
post #18

As someone who uses .NET daily, but loves Clojure and other functional programming paradigms - Records seem like a very compelling feature. Immutable data structures without any hassle to set up. Simply write “record” where you would normally write “class” and boom, you are working with immutable objects. This is one step closer to one the best features of Clojure IMO -everything is immutable. Additionally, there see…

Aren’t records pretty trivial to create as a custom class in C#?

Absolutely not.

Records generate a lot of code when you compile them, including methods to compare by value.

The boilerplate required to do that in C# without records is extensive and hard to maintain. Even structs, which are supposed to be value objects, are not easy to compare by value.

I'll put it this way: records are important enough that I stopped using C# because it lacked something like records, and now I'm going to pick it up again.

Re: .NET 5.0

#220
post #167
post #7

Earlier quoted context omitted.

What would you choose for server code?

.NET/C# are great platforms, it's the median .NET/C# developer and the general culture of working at one of these shops that ruins it. Just decades of over-engineering OOP "best practices" baggage that is impossible to shake off. Why do people "move" to new languages? Mostly to leave the baggage behind.

Good points there. I have to agree.
Post reply on HN