Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does .NET Core Work Internally versus .NET Framework?

How does .NET Core differ in terms of internal implementation from .NET Framework in regards to how programs are built and ran? I am aware that regular .NET Framework/C# projects essentially get compiled down to CIL code, distributed, and then compiled at runtime by the JITer, turning them finally into machine code on function-by-function basis (unless the programmer has specified the pre-compiled option). Is this all true for .NET Core applications as well? Are there any major differences?

Things to note:

  1. Yes, I am aware that both of these things are very complicated and I am not expecting the answerer to go into full details explaining every little component.

  2. I've heard of .NET Framework's CLR being called a virtual machine before but I know that is up to debate and have seen such debate in posts such as this one, as is the comparison of CIL to Java's bytecode. These are frivolous arguments and not relevant to the question.

  3. I've found similar questions out there, however, the questions seem to be focused on how .NET Core differs in terms of functionality/usability to us as client programmers. This question has nothing to do with that, but is asking how .NET Core is different from .NET Framework in terms of internal implementation.

Thank you.

like image 875
the_endian Avatar asked Jan 05 '17 07:01

the_endian


1 Answers

There isn't a difference in the IL or JIT process. I have old .NET code that directly executes IL that works fine on Core. They both fully implement the CLI ECMA standard, they both have the same runtime component.

There may be very fine grain differences on the implementation per platform, as there was between Windows .NET and Mono, but I'm not aware of any.

The CLI step and the framework are actually different things: you could probably build C# code that compiled to valid IL without either .NET or Core, but I'm not sure what you could actually do without even primitive types.

The difference is almost entirely in the supported framework - while full fat .NET is tied to Windows, the .NET Standard libraries are truly cross platform.

There this question is far too big: there has been a concerted effort to port over everything in .NET over to .NET Standard 1.5, but there's a lot of it. For .NET Core there are a couple of places there's a whole new paradigm (for instance ASP.MVC and ASP Core MVC are completely different). You may be better narrowing the question down to a specific area and platform.

Fairly soon all .NET will run on the .Net Standard 2.0 libraries, and .NET Framework 4/5/whatever will just be the legacy and Windows-only components (WPF, WinForms, etc) running on top.

like image 127
Keith Avatar answered Oct 31 '22 22:10

Keith