Live data from Hacker News

.NET 5.0

devblogs.microsoft.com

71–80 of 466 posts

Re: .NET 5.0

#71

Earlier quoted context omitted.

To me it's just so pointless, here's an example: using Microsoft.Extensions.Configuration; //extra line using Microsoft.Extensions.Options; //extra line public class AdminController : Controller { IOptions settings; //extra line public AdminController(IOptions settings) //extra code { this.settings = settings; //extra line } public void RandomMethod() { var a = settings.Value.FinallyMySetting; // 5 extra lines to acc…

Do you type every line typically? If you use Rider or VS pretty much every one of those lines can be auto generated with autocomplete. Also, this can easily be worked around. Just create a Singleton which has the settings injected into it. I prefer the testability of the injected version but if you'd rather access a static global it is very easy to do.

I do agree

I just type IOptions config in ctor, use ctrl+. and private readonly property and it's initialization is generated

Re: .NET 5.0

#72

Earlier quoted context omitted.

You'd want your config injected so that you can swap out configs for test harnesses for continuous integration and deployment. It's one of the mainstays of making your software deployable by automation.

You know a better way of doing this? appsettings.Test.json Voila, different settings! I've said elsewhere, the DEFAULT should be super simple, really, really, really easy to use. No thought, no effort, just use it. If you want to go all crazy and start injecting values into your config in your unit tests, great to have that option, you should have that option. But you're the one who should be scrabbling around writin…

I’m confused as to what you want instead of what Asp.Net core offers. Nothing is forcing you to inject configuration or to use IOptions. In most cases you don’t even need to do anything with the configuration builder because that is part of the default of how the host gets setup. You’re configuration should be automatically built from environment vars and appsettings.json.

And of course you can always just access environment variables directly if you want to.

Re: .NET 5.0

#73
post #59

Earlier quoted context omitted.

You can do that just with different config files or env vars too. No need to complicate code for stuff that can be done easily differently as well.

And then you realize that it's 2020 and you don't want configuration files, you want environment variables. Or, now that you've hardstuck yourself on environment variables and built all this stuff around them to set and re-set them properly between tests (now running either in multi-process, which good luck in most environments, or are just running in serial ), you're using k8s and the voluming of secrets rather than…

> DI is the removal of complication when it is done correctly. (I have no opinion on whether ASP.NET Core does it correctly.)

I do, it was done in a really weird way and I don't care for the provided DI Abstractions nor the 'Microsoft.Extensions.Configuration' namespace.

To take the 'common' object used for configuration, the nuget package for IOptions requires pulling in Microsoft's DI Abstraction..

That's the first sign of a smell. Config and DI can go hand in hand, but they should still be orthogonal.

The further you go down the DI stack, the more you can see that it's an abstraction has a lot of tradeoffs for front-line devs in the name of using the same abstraction for the underlying framework.

Re: .NET 5.0

#74

> .NET 6.0 will use the same approach, with net6.0, and will add net6.0-ios and net6.0-android Huge endeavor and launch! Looks like mobile app development will be the same with Xamarin

Mobile development in C# is just dead. Flutter got all the momentum.

Xamarin is huge in the .NET world and Microsoft is investing heavily into it. I know plenty of LOB apps, huge apps, built in Xamarin. I don't even know of a single app built in Flutter.

Re: .NET 5.0

#75
post #59

Earlier quoted context omitted.

And then you realize that it's 2020 and you don't want configuration files, you want environment variables. Or, now that you've hardstuck yourself on environment variables and built all this stuff around them to set and re-set them properly between tests (now running either in multi-process, which good luck in most environments, or are just running in serial ), you're using k8s and the voluming of secrets rather than…

> DI is the removal of complication when it is done correctly. (I have no opinion on whether ASP.NET Core does it correctly.) I do, it was done in a really weird way and I don't care for the provided DI Abstractions nor the 'Microsoft.Extensions.Configuration' namespace. To take the 'common' object used for configuration, the nuget package for IOptions requires pulling in Microsoft's DI Abstraction.. That's the first…

For sure--that sounds real smelly. (Unless it's being used to pull in attributes that are shared between and used for wire-up, but those should then be in a separate assembly.)

Re: .NET 5.0

#76

Earlier quoted context omitted.

Do you type every line typically? If you use Rider or VS pretty much every one of those lines can be auto generated with autocomplete. Also, this can easily be worked around. Just create a Singleton which has the settings injected into it. I prefer the testability of the injected version but if you'd rather access a static global it is very easy to do.

I do agree I just type IOptions config in ctor, use ctrl+. and private readonly property and it's initialization is generated

That doesn't work unless you already have the using statements, which you won't have as you haven't added it yet.

I just tried it.

Re: .NET 5.0

#77

> .NET 6.0 will use the same approach, with net6.0, and will add net6.0-ios and net6.0-android Huge endeavor and launch! Looks like mobile app development will be the same with Xamarin

Mobile development in C# is just dead. Flutter got all the momentum.

You seem to be correct (in so far as Firefox is also dead): https://trends.google.com/trends/explore?q=Xamarin,%2Fg%2F11...

Re: .NET 5.0

#78

Earlier quoted context omitted.

For simplicity? Just like how js get async await thing eventually.

So you want to pause the thread and keep it from processing other requests for simplicity?

Unless you have a lot of concurrent connections (C10k problem), having one thread per active request isn't a big deal. For my web applications, requests spend most of their time waiting on the database, and an open transaction is at least as expensive as a thread in an app server for many databases. So I agree that for most applications async isn't worth the complexity they introduce. In many implementations they also mess up your stacktraces, which makes debugging production issues harder.

Re: .NET 5.0

#79

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…

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.

Is Rust mature enough for web development already?

Re: .NET 5.0

#80
post #32

is this an in-place update to the netcore3.1 runtime or does it install side by side for net5.0? just want to know what kind of risk it is to install. i got bit by the netfx48 in place update.

How did net48 bite?
Post reply on HN