The Wayback Machine - https://web.archive.org/web/20190322172841/https://github.com/dotnet/coreclr
Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-level classes. https://docs.microsoft.com/dotnet/core/
Branch: master
Clone or download
jkoritzinsky Update Ubuntu 18.04 ARM64 queues (#23374)
* Update Ubuntu 18.04 queue.

* Update Debian 9 ARM queues as well.
Latest commit 5d57b87 Mar 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Documentation Reintroduce PR #22617 (Update added types and methoddefs on ApplyMeta… Mar 19, 2019
cross Fix tizen rootfs building (#22715) Feb 20, 2019
eng Update Ubuntu 18.04 ARM64 queues (#23374) Mar 22, 2019
scripts SuperPMI Collect/Replay/AsmDiff tool (#21252) Jan 18, 2019
src Updated Exception Handling for Collection<T> (#23290) Mar 22, 2019
tests Merge pull request #23350 from briansull/hva-tests Mar 21, 2019
.editorconfig Invalid setting csharp_new_line_within_query_expression_clauses in .e… Dec 8, 2018
.gitattributes Add Word2Vec Benchmark Harness (#17350) Apr 5, 2018
.gitignore Adding *.nuget.dgspec.json to the gitignore file. (#23033) Mar 6, 2019
.gitmirrorselective Rename gitmirrorfile Nov 11, 2016
BuildToolsVersion.txt Update BuildTools, CoreClr, IbcData, PgoData to preview1-03723-01, pr… Feb 28, 2019
CMakeLists.txt Renaming RuntimeEventSource to NativeRuntimeEventSource (#22533) Feb 12, 2019
CODE_OWNERS.TXT Update CODE_OWNERS.TXT (#17114) Mar 22, 2018
CONTRIBUTING.md Create CONTRIBUTING.md (#6386) Jul 22, 2016
Directory.Build.props Set copyright and package license Feb 21, 2019
Directory.Build.targets Add Azure DevOps signing support (#21545) Dec 15, 2018
DotnetCLIVersion.txt Update to latest released dotnet SDK (#18626) Jun 24, 2018
ILAsmVersion.txt Update BuildTools, CoreClr, IbcData, PgoData to preview1-03723-01, pr… Feb 28, 2019
LICENSE.TXT Update License and add 3PN notices (#10117) Mar 12, 2017
NuGet.config Add the coreclr blob feed as a restore source for test builds. (#22839) Feb 26, 2019
PATENTS.TXT Add additional data to PATENTS.TXT Nov 18, 2015
README.md Typos (#19737) Aug 29, 2018
THIRD-PARTY-NOTICES.TXT Update the double/float formatters to return the shortest roundtrippa… Feb 1, 2019
UpdatePublishedVersions.ps1 Fix UpdatePublishedVersions.ps1 Feb 15, 2019
all.locproj Initial commit to populate CoreCLR repo Jan 30, 2015
azure-pipelines.yml Correct Linux_musl_x64 Mar 21, 2019
build-packages.cmd Use arcade's version of dotnet to build (#22755) Mar 2, 2019
build-packages.sh For linux-musl-arm64 use OutputRid (#22840) Feb 25, 2019
build-test.cmd Use arcade's version of dotnet to build (#22755) Mar 2, 2019
build-test.sh Support gcc for build-test.sh Mar 18, 2019
build.cmd Avoid stack walk as specified in the exclusion list Mar 21, 2019
build.proj Consume optimization packages using new dependency flow system (#22915) Mar 1, 2019
build.sh Avoid stack walk as specified in the exclusion list Mar 21, 2019
clean.cmd Manually update the dependencies.props and move S.P.Corelib to use La… Feb 15, 2019
clean.sh Remove run.exe and config.json (#21608) Jan 31, 2019
clr.coreclr.props Enable FeatureDefaultInterfaces unconditionally (#23225) Mar 13, 2019
clr.defines.targets Add Utf8String skeleton (#23209) Mar 19, 2019
clrdefinitions.cmake
clrfeatures.cmake desktop port (#21523) Dec 26, 2018
cmake.definitions Change to Generate nuget packages for Windows Arm64 builds. Jun 25, 2016
cmake_msbuild.cmd Use arcade's version of dotnet to build (#22755) Mar 2, 2019
configure.cmake Add PGO support for Clang/LLVM on Unix (#10533) Mar 30, 2017
configurecompiler.cmake Suppress compiler warnings Mar 17, 2019
crosscomponents.cmake Remove more JIT LEGACY_BACKEND tendrils May 23, 2018
crossgen.cmake Delete code related to LoaderOptimization and SharedDomain (#21031) Nov 29, 2018
dac.cmake Only register signals and create alt exception stack in coreclr. (#19309 Aug 6, 2018
definitionsconsistencycheck.cmake Move intermediate file into intermediate dir (#5981) Jun 28, 2016
dependencies.props Consume optimization packages using new dependency flow system (#22915) Mar 1, 2019
dir.common.props Remove run.exe and config.json (#21608) Jan 31, 2019
dir.props Use arcade's version of dotnet to build (#22755) Mar 2, 2019
dir.targets update version of buildtools Jan 29, 2016
dir.traversal.targets Respond to PR feedback Feb 14, 2017
dotnet-download.ps1 Refactor dotnet download code in init-tools.cmd (#10527) Apr 1, 2017
dotnet.cmd Disable DOTNET_MULTILEVEL_LOOKUP in the build scripts (#22972) Mar 2, 2019
dotnet.sh Disable DOTNET_MULTILEVEL_LOOKUP in the build scripts (#22972) Mar 2, 2019
enablesanitizers.sh Fix asan false-positive errors: (#15563) Jan 25, 2018
functions.cmake Add prefix to DAC's PAL exports for alpine (#18873) Jul 13, 2018
generateexportedsymbols.awk Add prefix to DAC's PAL exports for alpine (#18873) Jul 13, 2018
generateredefinesfile.awk Add prefix to DAC's PAL exports for alpine (#18873) Jul 13, 2018
generateversionscript.awk Add prefix to DAC's PAL exports for alpine (#18873) Jul 13, 2018
global.json Update dependencies from https://github.com/dotnet/arcade build 20190… Mar 21, 2019
init-distro-rid.sh [Unix|*] Rework and share the logic for determining __DistroRid (#22628) Feb 21, 2019
init-tools.cmd Use arcade's version of dotnet to build (#22755) Mar 2, 2019
init-tools.msbuild Remove unused packages from init-tools.msbuild (#22884) Feb 28, 2019
init-tools.sh Use arcade's version of dotnet to build (#22755) Mar 2, 2019
netci.groovy Remove innerloop flow jobs that were missed (#23372) Mar 21, 2019
oacr.cfg Initial commit to populate CoreCLR repo Jan 30, 2015
perf.groovy Change perf smoketest queue (#23371) Mar 21, 2019
pgosupport.cmake Turn off PGO unprofiled warning on Linux (#17262) Mar 27, 2018
run-cppcheck.sh NetBSD: Add support for retrieving the number of available CPUs Jan 21, 2016
sanitizerblacklist.txt Reduce clr startup noise when using Clang sanitizers Jan 21, 2016
setup_vs_tools.cmd Support building with VS2019 Preview (#22525) Feb 12, 2019
sync.cmd Manually update the dependencies.props and move S.P.Corelib to use La… Feb 15, 2019
sync.sh Fix sync.sh syntax error (#22883) Feb 27, 2019
verify-so.sh Fix shared library dependencies verification on some platforms (#8349) Nov 29, 2016

README.md

.NET Core Common Language Runtime (CoreCLR)

This repository contains the complete source code for the runtime of .NET Core. If you are new to .NET Core start with the About .NET that quickly points you to .NET Core Tutorials.

.NET Core is best thought of as 'agile .NET'. Generally speaking it is the same as the Desktop .NET Framework distributed as part of the Windows operating system, but it is a cross platform (Windows, Linux, macOS) and cross architecture (x86, x64, ARM) subset that can be deployed as part of the application (if desired), and thus can be updated quickly to fix bugs or add features.

If You Just Want to Use .NET Core

Most users don't need to build .NET Core from source since there is already a built and tested version for any supported platform. You can get the latest released version of the .NET Core SDK by following the instructions on the .NET Core Getting Started page. If you need the most up to date (daily) version of this .NET Core installer you can get it from the latest Installers of .NET Core and .NET Core SDK. If you want one of our official releases, you can get the download from the download archive page.

Are you Here for Something Besides the Source Code?

In addition to providing the source code, this repository also acts as a useful nexus for things related to .NET Core including:

What Can you Make from this Repository?

.NET Core relies heavily on the NuGet package manager, which is a system to package, distribute and version software components. See https://www.nuget.org/ for more information on NuGet. For now it is enough to know NuGet is a system that bundles components into *.nupkg files (which are ZIP archives) and these packages can be 'published' either through a local file system path or by a URL (e.g. https://www.nuget.org/). There are then tools (e.g. nuget.exe, Visual Studio, dotnet.exe) that based on a configuration file (.csproj) know how to search these publishing locations and pull down consistent set of packages for the application.

In concrete terms, this repository is best thought of as the source code for the following NuGet package:

  • Microsoft.NETCore.Runtime.CoreCLR - Represents the object allocator, garbage collector (GC), class loader, type system, interop and the most fundamental parts of the .NET class library (e.g. System.Object, System.String ...)

It also contains the source code for the following closely related support packages.

  • Microsoft.NETCore.Jit - The Just In Time (JIT) compiler for the .NET Intermediate language (IL)
  • Microsoft.NETCore.ILAsm - An assembler for the .NET Intermediate language (IL)
  • Microsoft.NETCore.ILDAsm - A disassembler (Pretty printer) for the .NET Intermediate language (IL)
  • Microsoft.NETCore.TestHost - This contains the corehost.exe program, which is a small wrapper that uses the .NET Runtime to run IL DLLs passed to it on the command line.
  • Microsoft.TargetingPack.Private.CoreCLR - A set of assemblies that represent the compile time surface area of the class library implemented by the runtime itself.

Relationship with the CoreFX Repository

By itself, the Microsoft.NETCore.Runtime.CoreCLR package is actually not enough to do much. One reason for this is that the CoreCLR package tries to minimize the amount of the class library that it implements. Only types that have a strong dependency on the internal workings of the runtime are included (e.g, System.Object, System.String, System.Threading.Thread, System.Threading.Tasks.Task and most foundational interfaces). Instead most of the class library is implemented as independent NuGet packages that simply use the .NET Core runtime as a dependency. Many of the most familiar classes (System.Collections, System.IO, System.Xml and so on), live in packages defined in the dotnet/corefx repository.

But the main reason you can't do much with CoreCLR is that ALL of the types in the class library LOOK like they are defined by the CoreFX framework and not CoreCLR. Any library code defined here lives in a single DLL called System.Private.CoreLib.dll and as its name suggests is private (hidden). Instead for any particular PUBLIC type defined in CoreCLR, we found the 'right' package in CoreFX where it naturally belongs and use that package as its public publishing point. That 'facade' package then forwards references to the (private) implementation in System.Private.CoreLib.dll defined here. For example the System.Runtime package defined in CoreFX declares the PUBLIC name for types like System.Object and System.String. Thus from an applications point of view these types live in System.Runtime.dll. However, System.Runtime.dll (defined in the CoreFX repo) forwards references ultimately to System.Private.CoreLib.dll which is defined here.

Thus in order to run an application, you need BOTH the Microsoft.NETCore.Runtime.CoreCLR NuGet package (defined in this repository) as well as packages for whatever you actually reference that were defined in the CoreFX repository (which at a minimum includes the System.Runtime package). You also need some sort of 'host' executable that loads the CoreCLR package as well as the CoreFX packages and starts your code (typically you use dotnet.exe for this).

These extra pieces are not defined here, however you don't need to build them in order to use the CoreCLR NuGet package you create here. There are already versions of the CoreFX packages published on https://www.nuget.org/ so you can have your test application's project file specify the CoreCLR you built and it will naturally pull anything else it needs from the official location https://www.nuget.org/ to make a complete application. More on this in the Using Your Build page.


Setting up your GIT Clone of the CoreCLR Repository

The first step in making a build of the CoreCLR Repository is to clone it locally. If you already know how to do this, just skip this section. Otherwise if you are developing on Windows you can see Setting Up A Git Repository In Visual Studio 2017 for instructions on setting up. This link uses a different repository as an example, but the issues (do you fork or not) and the procedure are equally applicable to this repository.


Building the Repository

The build depends on Git, CMake, Python and of course a C++ compiler. Once these prerequisites are installed the build is simply a matter of invoking the 'build' script (build.cmd or build.sh) at the base of the repository.

The details of installing the components differ depending on the operating system. See the following pages based on your OS. There is no cross-building across OS (only for ARM, which is built on X64).
You have to be on the particular platform to build that platform.

The build has two main 'buildTypes'

  • Debug (default)- This compiles the runtime with additional runtime checks (asserts). These checks slow runtime execution but are really valuable for debugging, and is recommended for normal development and testing.
  • Release - This compiles without any development time runtime checks. This is what end users will use but can be difficult to debug. Pass 'release' to the build script to select this.

In addition, by default the build will not only create the runtime executables, but it will also build all the tests. There are quite a few tests so this does take a significant amount of time that is not necessary if you want to experiment with changes. You can skip building the tests by passing the 'skiptests' argument to the build script.

Thus to get a build as quickly as possible type the following (using \ as the directory separator, use / on Unix machines)

    .\build skiptests 

which will build the Debug flavor which has development time checks (asserts), or

    .\build release skiptests

to build the release (full speed) flavor. You can find more build options with build by using the -? or -help qualifier.

Using Your Build

The build places all of its generated files under the bin directory at the base of the repository. There is a bin\Log directory that contains log files generated during the build (most useful when the build fails). The actual output is placed in a directory like this

  • bin\Product\Windows_NT.x64.Release

There are two basic techniques for using your new runtime.

  1. Use dotnet.exe and NuGet to compose an application. See Using Your Build for instructions on creating a program that uses your new runtime by using the 'dotnet' command line interface.

  2. Use corerun.exe to run an application using unpackaged Dlls. This repository also defines a simple host called corerun.exe that does NOT take any dependency on NuGet. Basically it has to be told where to get all the necessary DLLs you actually use, and you have to gather them together 'by hand'. This is the technique that all the tests in the repo use, and is useful for quick local 'edit-compile-debug' loop (e.g. preliminary unit testing). See Using corerun To Run .NET Core Application for details on using this technique.

Editing and Debugging

Typically users run through the build and use instructions first with an unmodified build, just to familiarize themselves with the procedures and to confirm that the instructions work. After that you will want to actually make modifications and debug any issues those modifications might cause. See the following links for more.

Running Tests

After you have your modification basically working, and want to determine if you have broken anything it is time to run tests. See Running .NET Core Tests for more.

Contributing to Repository

Looking for something to work on? The list of up-for-grabs issues is a great place to start.

Please read the following documents to get started.

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.


Related Projects

As noted above, the CoreCLR Repository does not contain all the source code that makes up the .NET Core distribution. Here is a list of the other repositories that complete the picture.

  • dotnet/corefx - Source for the most common classes in the .NET Framework library.
  • dotnet/core-setup - Source code for the dotnet.exe program and the policy logic to launch basic .NET Core code (hostfxr, hostpolicy) which allow you to say 'dotnet SOME_CORE_CLR_DLL' to run the app.
  • dotnet/cli repo - Source for build time actions supported by dotnet.exe Command line Interface (CLI). Thus this is the code that runs when you do 'dotnet build', 'dotnet restore' or 'dotnet publish'.
  • dotnet/core-docs - Master copy of documentation for http://docs.microsoft.com/en-us/dotnet/

See Also

Important Blog Entries

License

.NET Core (including the coreclr repo) is licensed under the MIT license.

You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.