top | item 21050610

.NET Core 3.0

426 points| JaneLovesDotNet | 6 years ago |devblogs.microsoft.com

179 comments

order

avgDev|6 years ago

I have been developing in .Net MVC 5 and now the last 6 months in .Net Core 2.1. Core is pretty awesome, I would say the learning curve is pretty high, but I'm very satisfied. Previously, I used Java in school. The .Net stack offers a lot of jobs in enterprise companies, if you are someone that dislikes SV mindset.

Also, Visual Studio is an insane IDE. Although, I recently did have some nasty bugs but updates are coming out pretty quickly.

Edit: Microsoft has also added many new videos to help beginners, these cover various topics https://dotnet.microsoft.com/learn/videos.

gtsteve|6 years ago

VS is very good but I've been using Rider since the start of this year for most work, I found it to be a very strong competitor.

jsingleton|6 years ago

It's usually a good idea to wait for the patch release before updating. This applies to most software, including VS, VSC and .NET Core.

Being an early adopter sucks unless you're just testing it out. If it's your job then wait for it to stabilise and for the real-world bug fixes.

The next Long Term Support version of .NET Core will be 3.1. It should be out in November.

gargarplex|6 years ago

As a recruiter, I have to say that .Net is still used by startups, especially in Europe and cities like Manhattan with a large European population. I am shamefully plugging the fact that I am recruiting for said roles :-)

tabtab|6 years ago

Re: I would say the learning curve is pretty high

If you had to rank and list the top rough spots in the transition, what would they be? Entity-Framework changes are often cited, but what else is different enough?

dmix|6 years ago

It's great to see the enterprise world catching up with the tech world

privateSFacct|6 years ago

What's crazy is that this is what C# should have always been. I was into Mono way back because I thought niavely it was going to be more successful, but I think if C# had gone this route earlier -> the whole python / go etc popularity boom might have been softer and MS would have had a first class player that would have increase # of folks easily able to build in windows.

That and I never got to develop successfully beyond Forms - which I wish was not in preview from designer standpoint. I know old tech, but frankly for older programmers I find it easier and quicker to get stuff up with.

atonse|6 years ago

I’ve thought about this but I doubt it. The big change has been the perception shift.

.NET was always really solid tech. Microsoft has always had stellar developer technology. But the love affair with open source and the super villain role that Microsoft played, is what kept people away, not the tech itself.

I remember wanting to give a talk about how amazing C# was to a ruby group. I never did it, but it was definitely a quaint idea in 2011. But rubyists would’ve loved C#.

jsingleton|6 years ago

ifthenelseend|6 years ago

Now you can easily write the following state machine in C#:

    static State ChangeState(State current, Transition transition, bool hasKey) =>

    (current, transition) switch

    {

        (Opened, Close)              => Closed,

        (Closed, Open)               => Opened,

        (Closed, Lock)   when hasKey => Locked,

        (Locked, Unlock) when hasKey => Closed,

        _ => throw new InvalidOperationException($"Invalid transition")

    };

ComputerGuru|6 years ago

To be clear, this has nothing to do with .NET Core 3.0 but rather is a feature of C# 8.0, which depends on compiler support that can be targeted to any previous version of .NET Core or Framework, all the way back to Framework 2.0 (tested myself, although MS says not to target 2.0 or 3.5).

platz|6 years ago

Still no exhaustiveness checking like a true match expression unfortunately, which is what would give it parity against the traditional subclass/polymorphic approach.

nikofeyn|6 years ago

i actually just did this in f# using the MailboxProcessor. it's beautiful. although, f# has had this since the beginning and is much cleaner being able to define the states and transitions using discriminated unions and having exhaustive pattern matching.

hmexx|6 years ago

List of performance improvements is mind-boggling:

https://devblogs.microsoft.com/dotnet/performance-improvemen...

How could a mature standard library / frameworks have so much performance gains to be had?

fortran77|6 years ago

The "core" library was designed for portability and it's not as old as the .NET used for Windows desktop development, which is very mature and very performant.

giulianob|6 years ago

I believe most of these are from Span which allows doing a lot of operations (e.g. substring) without allocating a new object.

oaiey|6 years ago

Well, in the traditional desktop space performance was not that critical as it is with cloud deployments. Also hardware intrinsics are a new toy they have available.

9wzYQbTYsAIc|6 years ago

A lot of work was done recently with compiler optimizations and using hardware intrinsics for core functions.

The_rationalist|6 years ago

Would be really nice to see performance comparisons against a chromium equivalent for the same UX.

Analemma_|6 years ago

I think it's a combination of monopoly effects plus the benefits of open source: back when .NET was closed-source and only available on Windows, the only way to ship a performance improvement was if an individual developer at Microsoft could convince his boss it was worth it. And it was rarely worth it, because .NET only ran on Windows, its only customers were .NET-only enterprise shops who weren't about to move to an entirely new framework because of perf problems, and there was always a long list of feature requests that PMs would give priority to.

But now that .NET runs everywhere, it has to compete with projects that have been shipping performance improvements all along. Happily, since it's now open-source too, it can accept those changes from anyone.

_hardwaregeek|6 years ago

Non nullable reference types are so awesome! I'd love for the C# team to publish some posts on the creation of this feature. Most of the non nullable type systems exist in functional, or pseudo functional languages (Rust has rather functional semantics). It's very neat to see a honest to god mutable object oriented language implement non nullability. They probably had some interesting implementation challenges.

Also, is Java working on this too? I heard that they have Maybe, but that's pointless without non nullability.

wvenable|6 years ago

PHP has non-nullable reference types!

There are some really good write-ups by the C# team on the creation of non-nullable types and how it's implemented but my google-fu is failing me on it.

It's obviously a bit a of hack involving annotations/attributes but for the end user the result is pretty seamless.

jdmichal|6 years ago

Java does indeed have `java.util.Optional`. As a non-primitive type, it can itself be `null`, or be non-`null` but not contain a value.

In other words: I used to have `null` problems. Then I used `Optional`, and now I have two `null` problems!

disease|6 years ago

Don't know about Java, but last I checked there were plans to add non-nullable reference types to Dart.

rafaelvasco|6 years ago

When I was in University people loathed .NET and idolized Java. Back then I choose C# instead of Java for my main language/toolset; People thought I was crazy. That was 10 years ago. So happy to see how much C# ecosystem has improved and keeps improving; Only thing missing for me is an official full featured C# to C++ transpiler; Only way, right now, of reaching game console platforms is by converting from C# to C++ unfortunately;

darzu|6 years ago

Or use Unity?

tofflos|6 years ago

It's nice to see Alpine on the list of supported operating systems. The image mcr.microsoft.com/dotnet/core/runtime:3.0.0-alpine3.9 is 86.7MB.

gameswithgo|6 years ago

I recently did a live coding tutorial on using SIMD intrinsics which is one of the big new features in .NET Core 3.0. It covers the basics of what is SIMD, what are intrinsics, and I do some live coding/benchmark examples in C# where I cover how to lay out data and use SIMD effectively:

https://www.twitch.tv/videos/482930779?t=00h09m01s

Nelkins|6 years ago

Is anybody using Blazor for anything that isn't a toy? I'm interested in using it at work but because it appears that the payload is relatively large I wouldn't want to use it for anything that wasn't internal facing.

manigandham|6 years ago

Client-side Blazor is not production-ready with Asp.NET Core 3.0. It's coming in a later release and only server-side Blazor is launched today.

We've been using the server-side components for lots of internal apps. It's very fast and productive to work with, and a great option for internal/enterprise/LOB apps that don't have a lot of users and can handle an occasional reconnection/interruption.

m_fayer|6 years ago

We're exploring using server side blazor for a desktop app. You just bundle the "server" right into the app together with a webview to show your UI. No performance issues because there's only ever one user and you're not relying on a network (or mono or wasm). More exciting, it feels like C# in the browser, but there's no sandbox or threading limitations to speak of. So far it's pretty awesome.

landr0id|6 years ago

>it appears that the payload is relatively large

Not knowing much about Blazor, what are you referring to here? The size of the WASM blob for your own code, or does Blazor have an associated runtime that's large? And what is considered "large"?

daliz|6 years ago

It would have been great if it allowed to make .NET Desktop apps for macOS and Linux, in addition to Windows.

oaiey|6 years ago

Scott Hunter today presented a Blazor based Electron App in the .NET 5 timespan.

I am not the biggest fan of HTML, but considering the maturity of that ecosystem, design tools and knowledge among designers, that could be a very valid move.

pcunite|6 years ago

.NET Core 3.0 will be available with RHEL 8 in the Red Hat Application Streams, after several years of collaboration with Red Hat.

That's a big deal! Nice.

krat0sprakhar|6 years ago

> Nullable enables you to directly target the flaws in code that lead to NullReferenceException. The lowest layer of the framework libraries has been annotated, so that you know when to expect null.

I hope Java gets this one day.. would be a cool feature

royjacobs|6 years ago

In the JVM land you can check out Kotlin, which does this.

mrighele|6 years ago

You can try checkerframework [1], which uses annotations to perform extra typechecking at compile time, including nullable/not-nullable checks. Works properly altough it has a few issues: the biggest is that support is still stuck at java 8, and the framework is sometimes not smart enough to see that you already checked if a nullable field is null or not and you can safely use it.

[1] https://checkerframework.org/

jrimbault|6 years ago

Optional ? But redoing the standard lib would be no go in javaland ? It's the non nullable reference I find interesting.

xvilka|6 years ago

Too bad FreeBSD support didn't make it into this version.

GordonS|6 years ago

Or indeed Linux x86 support :(

DenisM|6 years ago

The only way to get C# 8 is to move to .NET Core, I can't really avoid this anymore. And for me it means moving to ASP.NET Core...

Anyone recently migrated projects from ASP.NET MVC to ASP.NET Core? I hope there is a gradual way, like this: https://www.hackernoon.com/how-to-migrate-project-from-aspne...

pathartl|6 years ago

Not migrated, but we do a lot of CRUD based applications for clients and have a small dev team so it feels like we're kinda porting it over.

The largest change is dependency injection and Entity Framework. DI is insanely better and just more intuitive. EF is really a move from EF to EF Core which has quite a few differences that can introduce some road bumps.

In my opinion, I've gained the most from moving from HTML helpers in Razor to Tag Helpers. It's basically just components for Razor, but it allows us to make a really nice UI library and cuts down on so much of our markup without having to write a bunch of overloads for the same helper.

As far as MVC vs. Razor Pages, I'm still not in love with Pages. It feels a bit too much like ASP.NET Web Forms did. I still use MVC practices and it's almost the same exact experience. AJAX forms are a bit better this time around, but I'm really waiting until Blazor becomes more viable before I make a jump like that.

WorldMaker|6 years ago

Doing a quick skim, it feels like that migration guide should still cover the basics. (I don't think there is a big developer-facing change between ASP.NET Core 2.1 and 3.0; small subtle things like the Generic Host Builder. But you should be fine using the guide here to migrate to 2.1 and you can find simple posts on the 2.1 to 3.0 changes.)

topbanana|6 years ago

> The only way to get C# 8 is to move to .NET Core

That isn't true. You can target .Net framework 4.0 onwards.

factorialboy|6 years ago

Sorry for a basic question, can this be used to make desktop apps across platforms?

ticmasta|6 years ago

The short answer is yes.

How you approach this is very dependent on where you're coming from (i.e. existing solution) but with WPF and Winforms now part of Core 3.0 you can then build a native, single exe by specifying the target architecture (ex: win x64) and then bundling the framework with your app. They do some trimming as well (i.e. tree shaking) to get the exe size down but have admitted it's still in early stages and sometimes drops required framework components. You can fix this by adding an explicit reference to the assembly in your project source though...

There are a million ways to get onto different platforms though, ranging from the above, to xamarin to electron (via blazor), to net-new apps, etc.

ragechip|6 years ago

This is a good leap release from msft.

mcdermott|6 years ago

C# (the default .Net lang) has so much ceremony, boilerplate/scaffolding and IDE dependence (IDE programmers) and OOP overhead that it requires 5x more lines of code than the same app in Python or Go. Every time my interest peaks, I take a look leave with the same feeling that it's a dated/bloated OOP relic and would take all the joy out of programming. I've also noticed that most C# programmers don't usually know another language (other than a little JS) and seem totally dependent on Visual Studio; if all they had was a text editor they'd be lost. That's not a good place to be.

com2kid|6 years ago

C# has very minimal boilerplate for a lot of uses. I can throw together a simple CRUD UI app in WinForms in well under a day. Visual Studio handles writing all the data binding code for me, code that I'd have to write myself in any other language.

Using one of the enterprise frameworks, sure, those all have boilerplate, in any language, especially the older frameworks.

And for some tasks, the amount of boilerplate is tiny. I can write out a struct/class with property names matching my JSON, and watch as C# automatically data binds the JSON to a UI. The amount of boilerplate I need to do that in the browser is pretty much identical, or I can learn / figure out some fancy auto-binding toolkit that has its own boiler plate and learning curve.

You can be seriously functional in C#. Passing around lambdas and using functional techniques to manipulate data has been idiomatic C# for over a decade.

> I've also noticed that most C# programmers don't usually know another language

Stereotyping is not good. I <3 C#, but I've written embedded C, C++, JavaScript, Typescript, and Python.

If you go to most corporate dev places, you will find a significant population of single language devs. Same things happen with any popular corporate language. While I agree that learning multiple programming languages makes for better developers, blaming a language for being popular is hardly fair.

Heck the number of developers who have historically only worked in C/C++ was really high for multiple decades.

mattferderer|6 years ago

I think you might want to take a slightly different look at it as I have found the opposite.

You also might need to find better C# programmers as I honestly don't know any C# programmers who only know one language or one editor. An awesome IDE is big perk to development. I don't think that should be considered a con.

.NET also has tons of "magic features" like Data Annotations & Attribute Tags for those who want some magic that reduces code & helps get stuff done faster.

JS & other languages reference it when looking to introduce new features.

C# is anything but dated. One could call it bloated as it is one of the most flexible languages with about 10 ways to do anything. That is a strength & a weakness of any language that positions itself as a Swiss army knife type tool that wants to be able to be used everywhere. With C# you can write a lot of nice fairly functional programming style code & OOP code which is a nice perk.

Parazitull|6 years ago

If you're interested in .net and the clr, you could replace c# with f#.

It's the most practical functional language that I've tried. Great for domain modeling and it can used in C# projects.

I also think that c# is too verbose so what I normally do: asp.net core mvc for routing, templating, authentication / authorization, data access etc and then reference an f# project that contains the domain logic. The best of both worlds.

caseymarquis|6 years ago

If you're writing boilerplate code in C#, it's either because you prefer to be explicit, or because you don't know how to use reflection and dynamic compilation yet. Using C# without reflection is like using Scheme without macros. That said, just like macros lead to DSLs, reflection leads to custom frameworks which then have to be explained to newcomers. It's definitely a cost/benefit thing, and there's an argument against ever using reflection. I can't live without it at this point though. You could say I've 'gone through the looking glass'.

If you're a C# dev who hasn't dug in to reflection yet, the gist is that all the things that the MVC, ORM, DI frameworks do, you can also do. This allows you to build custom frameworks which eliminate boilerplate.

manigandham|6 years ago

I'm not sure about the comparison to Go as that can get very verbose. Same with Python. And JS is an absolute mess compared to C#/.NET which has a fantastic standard library and many conventions to get going fast.

.Net (and Java) run the Fortune 1000 so there will of course be lots of devs specialized in that. There's nothing wrong with being very good with 1 language and stack when you're paid to be productive for the company. Also you can definitely write C# with a simple text editor if you have to, and VSCode is pretty slim already, but why would you want to when there's such a powerful IDE available?

This sounds like a purity argument about how to be a "real programmer", but I would much rather work with people who are good at what they do and get things done instead.

michannne|6 years ago

That was a lot of predispositions. I can say for sure I've never scaffolded anything in C#, I can write a fully functional web app using Notepad++, the different parts of the startup are not hard to memorize, and I can't imagine scaffolding being useful in a console application.

Yeah, it requires more lines to achieve the same thing in other languages, that isn't a pro or con.

And myself personally, I started with Basic, and have used C++, C, Python, Java, JS and C# throughout my career, but I'm also sure you can find many more Python/Go developers who only know Python/Go

It'a unfortunate you don't like the language and I hope Microsoft and the open-source developers continue to add more features so that one day you'll find the joy may developers have found in using C#

bobcostas55|6 years ago

I don't get why people don't like IDEs. If you're digging a ditch you're dependent on your shovel (or even better, an excavator). You can do it with your hands, but why would you want to? Just as the shovel magnifies your digging capacity, the IDE magnifies your capacities as a coder.

Spooks|6 years ago

C# developer here. I picked up Java very quickly... most other OOP languages comes pretty easily as well, after learning the syntax that is.

But I definitely lean on the intellisense of the IDE fairly regularly, I don't think I would completely lost, but it would take me longer.

Dude2029|6 years ago

Break the bubble, talk to more C# devs from different kinds of businesses.