.Net kernel (GC, JIT, interop, ...) in Open Source

Original author: .Net Team
  • Transfer
We are pleased to announce that CoreCLR is now on github and now you have access to all of its source codes. CoreCLR is a .NET Core runtime that performs functions such as garbage collection or compilation into final machine code. .Net Core is a modular implementation of .Net, which can be used as a base for a huge number of scenarios, the scale of which varies from simple console utilities to web applications hosted in the cloud. To understand how .Net Core differs from .Net Framework, take a look at the “Introduction to .Net Core” post

Now you can download the CoreCLR source code, bounce, and do pull requests, you can also compile it directly on your PC. We released a complete and up-to-date CoreCLR implementation that includes RyuJIT, .Net GC, native Interop, and many other .Net runtime components. This release follows the same principles as all of our latest open-source library releases: make the entire .Net Framework open sourced.

Today, the .Net kernel compiles and runs (apparently CI) on Windows. We will add implementations for Mac and Linux-specific platform things in the next couple of months. We also already have some Linux-specific code in .Net Core, however, we just started porting from Windows to other platforms. On the contrary, we wanted to open the source texts from the very beginning, so that you and us would travel to other platforms, possibly contributing.

Let's see what is inside the repository

The CoreCLR repository in its structure is very similar to the CoreFX repository, in which many of you have managed to work over the past months. We will continue to develop both repositories at the same time, so that you end up feeling naturally, being in a truly huge code base.

In terms of size, the CoreCLR repository consists of approximately 2.6 million lines of code. Moreover, in the framework of these calculations, GC occupies about 55 thousand, and JIT itself - about 320 thousand lines. We also recently shared with you that CoreFX takes up 500,000 lines of code, which is about 25% of its estimated total size. And, it’s scary to say, but when everything is ready, we will have about 5 million lines of code. On GitHub

One of the key differences between repositories is that CoreFX is written in C #, while CoreCLR contains a huge amount of code in both C # and C ++. Also, the CoreCLR repository requires a huge number of tools for building code, some of which are not supplied with Visual Studio. We left a dependency on CMake, opensource and a cross-platform system for building projects. Since we needed a build system that would feel great on Windiws, Mac, and Linux, we looked at various options and, as a result, chose CMake.

You can learn how to compile CoreCLR from the CoreCLR Developer Guide . The team will constantly update it, especially when Linux and Mac become a reality.

We also really hope that the community will contribute to the development of the project by creating pull requests (from a translator: CoreFX has a huge number of contributors who constantly write code for CoreFX). Because of its size, .Net Core runs on a huge number of scenarios, and therefore it is very important to have a large number of tests to cover their maximum number.

Conversation with the team

Using the link below you can see the dialogue with the team about the current release:

Building Applications with .Net Core

It's great to see .Net CoreFX and CoreCLR implementations in open source. And you will be surprised what types of applications you can build with it. There are two types of applications that you can build at the moment:
  • ASP.NET 5 Web Applications and Services
  • Console applications

We talked about ASP.NET 5 applications for about a year and now you can build them using both the .Net Framework and CoreCLR / CoreFX. ASP.NET 5 uses mono runtime and can run on both Mac and Linux . Once .Net Core will support these systems, you can use it on these platforms. You can learn more about how to work with ASP.NET 5 from the ASP.NET team blog or at asp.net . Also, if you want to try ASP.NET 5 in action right now, then download the Preview version of MS Visual Studio 2015.

We want to make it possible to build CoreFX and CoreCLR repositories and use the results in ASP.NET 5 applications, but so far this is not possible for several technical reasons, but we are working on it. The ultimate goal is very complex: we should be able to combine community changes (forks) and our own changes and get the basic stack for your applications.

The console type of applications allows you to understand what CoreCLR is. It also provides a very flexible base for building absolutely any application, whatever you want. The largest percentage of infrastructure. which we use for testing uses this particular type of application. You can also build your own CoreCLR and run applications on top of it.

.Net Core Console Apps

The console type of applications for .Net Core is currently a by-product of our workflow. And over the next few months, we will form it as a completely ready-made type of application, including code templates in Visual Studio and a debugger (i.e. it doesn’t exist, it seems - approx. Transl. ). We will also support OmniSharp for console applications (who does not know - Sublime text 3 based IDE for .NET). So, soon you will have a full-fledged ability to build cross-platform applications that will run from a single executable file.

Below is the first demo of a console application running under CoreCLR.

Console App Walkthrough

The easiest way to build a CoreCLR application is to create a console application. You can get it from our new corefxlab repository. In order to use it, you can simply clone, compile and run using the command line:
cd .\corefxlab\demos\CoreClrConsoleApplications\HelloWorld
nuget restore

Of course, since you cloned the repository, you can also open the * .sln file in your copy of Visual Studio. Please note that debugging is not yet possible ... But it is only for those who make mistakes, right?

You can also modify CoreCLR and launch a console application that will use the new runtime that you just made yourself, making changes to the kernel. At the moment, the automated assembly is not at the highest level, so in order to assemble the kernel yourself, at the moment, you need to do the following steps:

  1. Modify CoreCLR the way your heart tells you
  2. Build CoreCLR with build.cmd x64 release
  3. Copy the files from coreclr \ binaries \ x64 \ release to corfxlab \ demos \ CoreClrConsoleApplications \ HelloWorld \ NotYetPackages \ CoreCLR:
    1. coreclr.dll
    2. CoreConsole.exe
    3. mscorlib.dll
  4. Recompile HelloWorld.sln


We were preparing to make CoreCLR open for several months, while developing many new features. Now you have the opportunity to observe the daily work of our team committing committing (just like in CoreFX). Feel free to pick up your repository and watch these changes. For our part, we will monitor the list of Issues and PR in order to be able to follow your wishes.

If you're excited and determined to chat with someone, head over to the .Net Foundation forums. Here you will find several branches where you can learn more about CoreCLR. The branches are also monitored by members of our team who are ready to answer any of your questions.

We have a lot to do and the next stop is .Net Conf - a virtual conference on .Net, which is scheduled for March 2015 and there we hope to show you a good demo

Also popular now: