Fact-checked by Grok 2 weeks ago

Common Language Infrastructure

The Common Language Infrastructure (CLI) is an open that defines a unified execution environment enabling applications written in multiple high-level programming languages to run across diverse system architectures and operating environments without requiring language-specific rewrites or recompilations. Originally developed by as the foundation for the .NET Framework, the CLI specifies key elements including the (CTS) for type compatibility, the Virtual Execution System (VES) for runtime services like and security, the Common Language Specification (CLS) for between languages, for assembly descriptions, the (CIL) instruction set for portable , standardized libraries, and a debug interchange format. Standardized as ECMA-335 (6th edition, June 2012) by and as ISO/IEC 23271:2012 by the , the CLI remains current following its last review in 2021 and supports cross-platform portability through managed code execution. The CLI is structured into six partitions: Partition I outlines the overall architecture, CTS, VES, and CLS; Partition II details metadata semantics; Partition III describes the CIL instruction set; Partition IV defines library profiles and base class libraries; Partition V covers debugging formats; and Partition VI provides annexes such as sample profiles and compliance guidelines. This design promotes language independence, allowing compilers for languages like C#, Visual Basic .NET, and F# to target the same runtime, while enabling features such as just-in-time (JIT) compilation, garbage collection, and exception handling at the infrastructure level. Primary implementations include Microsoft's Common Language Runtime (CLR) in .NET Framework and modern .NET platforms, as well as the open-source Mono project, which extends CLI support to non-Windows environments like Linux and macOS. By providing a portable, secure, and extensible framework, the CLI has facilitated the development of robust, multi-language applications in enterprise, web, and mobile contexts, influencing subsequent standards and runtimes beyond .NET ecosystems.

Introduction

Definition and Goals

The Common Language Infrastructure (CLI) is an open specification defining a virtual execution environment that enables the execution of programs written in multiple high-level programming languages across diverse hardware and operating system platforms, without requiring rewrites for specific architectures. It encompasses a runtime environment known as the Virtual Execution System (VES), which manages code execution through a standardized intermediate language called Common Intermediate Language (CIL), along with metadata for describing program structure and behavior. This framework supports a unified type system to ensure consistent data representation and operations across languages. The primary goals of the CLI are to promote by allowing seamless integration and reuse of components written in different programming languages, to ensure portability of compiled across various CLI implementations and , and to simplify the delivery of essential runtime services including , , security enforcement, and verification. These objectives address the challenges of traditional language-specific runtimes by providing a language-neutral that abstracts platform dependencies and fosters verifiable, secure execution. By adhering to open standards, the CLI reduces , enables high-level languages to compile to a common intermediate form for efficient execution, and facilitates component-based through modular assemblies. It forms the foundational architecture for environments such as .NET, partitioning the specification into executable code (via CIL), descriptive , and supportive mechanisms to achieve these aims.

Historical Development

The development of the Common Language Infrastructure (CLI) originated in Microsoft's .NET initiative during the late 1990s, initially codenamed Next Generation Windows Services (NGWS), which aimed to create an internet-based platform for distributed computing and web services. In June 2000, Microsoft publicly announced the .NET strategy, rebranding NGWS as the foundation for a new generation of software built around XML web services, with the CLI serving as the core runtime specification to enable language interoperability and managed code execution. To promote widespread adoption and avoid proprietary lock-in, Microsoft shifted from a closed development model by submitting the CLI specification, along with C#, to ECMA International in October 2000, in collaboration with Hewlett-Packard, Intel, and over a dozen other industry leaders. This effort drew inspiration from existing virtual machine runtimes, including the Java Virtual Machine, to design a platform-independent execution environment focused on security, portability, and multi-language support. The first edition of ECMA-335 was ratified in December 2001, marking the CLI's formal standardization. Subsequent revisions refined the specification to align with evolving needs: the second edition appeared in December 2002, followed by the third in June 2005, the fourth in June 2006 (synchronizing with the first ISO/IEC 23271 adoption in 2003 and update in 2006), the fifth in December 2010, and the sixth in June 2012, which incorporated enhancements for better and while maintaining alignment with ISO/IEC 23271:2012. A key milestone was the release of the .NET Framework 1.0 in February 2002, the first major implementation of the CLI, which demonstrated its practical application in building secure, scalable applications. In November 2014, Microsoft open-sourced .NET Core, a modular evolution of the .NET platform, enabling community-driven contributions and extensions to the CLI ecosystem, including cross-platform support for and macOS, and fostering broader innovation beyond the original Windows-centric design.

Standards and Specifications

ECMA and ISO Standardization

The Common Language Infrastructure (CLI) specification, known as ECMA-335, has been developed and maintained by Ecma International's Technical Committee 39 (TC39), later redesignated as TC49, since its initial submission in 2000. TC39 oversees the creation of technical reports and iterative edition updates, ensuring the standard evolves through collaborative input while preserving core compatibility. The process involves drafting by task groups, followed by member reviews and public enquiry periods to incorporate feedback before final approval by the Ecma . In 2003, ECMA-335 was adopted by the (ISO) and the (IEC) as ISO/IEC 23271, marking its first international . Subsequent editions aligned closely with ECMA updates, including the fourth edition in 2006 and the sixth in 2012, with the ISO version last reviewed and confirmed in 2021, maintaining its current status without technical revisions. This alignment ensures that ECMA and ISO versions remain synchronized, facilitating global adoption and interoperability. Standardization through ECMA and ISO provides key benefits, including a vendor-neutral specification that promotes open implementation across diverse platforms and languages. It enables formal certification of compliant runtimes, such as those from multiple vendors, and offers legal protections under open standards policies, reducing barriers to innovation and competition. Contributions to the development process have come from various companies, including Microsoft, IBM, Intel, Hewlett-Packard, and Borland, emphasizing backward compatibility in revisions to support existing ecosystems. As of 2025, the CLI remains at its 6th edition under ECMA-335, published in June 2012, with no subsequent editions issued, reflecting a stable specification that continues to underpin modern implementations like .NET.

Partitioned Architecture

The Common Language Infrastructure (CLI) specification, as defined in ECMA-335, is organized into six partitions to provide a modular framework that supports the development of portable, interoperable software across multiple languages and platforms. This partitioning separates concerns such as foundational concepts, code representation, libraries, and supplementary materials, enabling a structured approach to specification and implementation. The following table outlines the six partitions, their primary contents, and roles:
PartitionTitlePrimary ContentsRole
IConcepts and ArchitectureCLI overview, Common Type System (CTS), Virtual Execution System (VES), Common Language Specification (CLS), exception handling, type safety, and verification rules.Establishes high-level architectural principles, including type safety and assignment compatibility, to ensure portability and interoperability.
IIMetadata Definition and SemanticsMetadata tables (e.g., TypeDef, MethodDef), heaps (e.g., #Strings, #Blob), tokens, signatures, and file formats like PE/COFF.Defines how types, members, and assemblies are described in a self-contained manner for runtime loading and execution.
IIICIL Instruction SetCommon Intermediate Language (CIL) opcodes, stack operations, control flow instructions, and verification semantics.Specifies the machine-independent instruction set for compiled code, enabling just-in-time or ahead-of-time execution.
IVProfiles and LibrariesBase class libraries (e.g., System namespace), profiles (e.g., Kernel, Compact), and standard APIs like System.Exception and System.Action.Provides standardized libraries and configurable profiles to support varying levels of functionality across environments.
VBinary Formats and Debug Interchange FormatPE/COFF executables, metadata embedding, debugging tables (e.g., SymMethod), and security models.Standardizes file formats for executables, assemblies, and debugging to facilitate cross-tool interoperability.
VIAnnexesSample programs, portability guidelines, programming conventions, and extensions like parallel libraries (e.g., System.Threading.Parallel).Offers supplementary examples, clarifications, and implementation guidance to aid conformance and adoption.
The partitioning serves multiple purposes, including allowing independent implementation of subsets for targeted optimizations, facilitating incremental updates to specific areas without overhauling the entire specification, and enabling profiling for specialized use cases such as kernel-mode environments or resource-constrained devices. For instance, developers can implement core execution from Partitions I, III, and V while selectively adopting libraries from Partition IV. These partitions interlink to ensure full compliance and cohesive operation: Partition I provides the conceptual foundation referenced by all others; Partition II's metadata tokens are used in Partition III's CIL instructions and Partition V's binaries; Partition III relies on Partition I's type safety rules for verification; Partition IV builds on types from Partitions I and II; and Partition VI cross-references examples across the specification. This interdependence promotes a unified where changes in one area, such as opcode additions in Partition III, propagate through metadata in Partition II for consistent runtime behavior. Over successive editions, the partitioned structure has evolved to enhance cross-platform support and ahead-of-time (AOT) compilation. The 5th edition (December 2010) introduced variance semantics for generics in Partition I, building on the generics support added in the 3rd edition (June 2005); type forwarders in Partition II for better assembly relocation; and relaxed in Partition VI to enable AOT optimizations like code hoisting and vectorization, all while maintaining compatibility with diverse operating systems. These additions, building on earlier editions like the 2005 update, underscore the specification's adaptability without disrupting the modular design.

Core Components

Common Type System (CTS)

The Common Type System (CTS) serves as the foundational type model within the (CLI), specifying how types are declared, used, and managed to ensure consistent representation and behavior across different programming languages. It categorizes types into value types and reference types, supports advanced features like generics, and enforces rules for type compatibility, all while prioritizing strong typing and safety to facilitate seamless . At its core, the CTS distinguishes between value types and reference types. Value types represent data as sequences of bits stored directly in their location, without indirection, and are typically allocated on the stack or inline within objects; they derive from System.ValueType, are sealed, and include primitives such as int32 as well as custom structs. In contrast, reference types denote locations on the , accessed via opaque references and subject to collection; these encompass classes, interfaces, arrays, and delegates. The CTS further supports generics through metadata-encoded parameterization, allowing reusable, type-safe code with features like , contravariance, and constraints. Additionally, and enable interoperability between value and reference types by converting value types to System.Object on the and extracting them back, respectively, using dedicated instructions like box. Type compatibility in the CTS is governed by rules for and conversions, ensuring safe interactions between types. All types ultimately derive from the common base type System.Object, providing a universal root for hierarchies. Implicit conversions (widening) occur automatically without , such as from a derived type to its base, while explicit conversions (narrowing) require casts and may involve potential loss, verified at for safety. Coercion mechanisms, including special instructions like conv, handle numeric and enumeration interconversions, with managed pointers convertible to unmanaged forms under controlled conditions. Key features of the CTS emphasize robustness and expressiveness. It enforces strong typing by associating every value and location with a specific type, as defined in signatures, preventing ambiguous operations. is maintained through runtime verification that tracks value types in detail, restricting unsafe pointer manipulations and ensuring memory integrity within the verifiable code subset. The system supports multiple inheritance of interfaces via tables like InterfaceImpl, allowing a type to implement zero or more interfaces without inheriting their implementation, though classes permit only single inheritance. Types are represented in a metadata-driven manner, using tables such as TypeDef and TypeRef for self-describing declarations that enable independent compilation and runtime resolution. The CTS plays a pivotal role in interoperability by standardizing type semantics, allowing languages such as C# and VB.NET to define and consume shared types without conflicts, as long as they adhere to CLI metadata conventions. This unified model ensures that a type defined in one language can be seamlessly used in another, promoting code reuse across the CLI ecosystem. The CTS relates to the Common Language Specification (CLS) by providing the complete type framework, with the CLS defining a compliant subset for broader language compatibility. A notable limitation of the base CTS is the absence of support for operator overloading, which is not defined in its core rules or metadata; such functionality is instead managed by individual language specifications and compilers.

Common Language Specification (CLS)

The Common Language Specification (CLS) defines a subset of the rules from the Common Type System (CTS) to promote interoperability among components written in different programming languages targeting the Common Language Infrastructure (CLI). It provides optional guidelines for creating "CLS-compliant" code, particularly focusing on public application programming interfaces (APIs), where types and members must adhere to a restricted set of CTS features to ensure accessibility across compliant languages such as C# and Visual Basic .NET. For instance, public signatures cannot use unsigned integer types like UInt32 as parameters or return values, though they may be used internally. Key CLS rules cover several areas to enforce consistency and portability. Naming conventions require identifiers to follow Normalization Form C for case-insensitive comparisons and prohibit overloading based solely on case differences or return types (except for implicit and explicit conversion operators). Accessibility modifiers must not widen when overriding inherited members, and requires thrown objects to derive from .Exception, supporting mechanisms like catch, filter, finally, and fault blocks. Additionally, rules avoid certain CTS features in exposed , such as unmanaged pointers, vararg methods, typed references, and non-CLS integer types for enums, while mandating that arrays have zero lower bounds and interfaces contain no static methods or fields. Compliance with CLS is indicated through the System.CLSCompliantAttribute, which can be applied at the assembly, , type, or member level to signal adherence. There are two primary levels: CLS-authoring for libraries, where developers ensure all public elements conform to CLS rules to enable broad consumption; and CLS-consumption for client code, which must handle only CLS-compliant features from referenced assemblies. Non-compliant elements in an otherwise compliant assembly should be explicitly marked with CLSCompliant(false) to suppress warnings and provide alternative compliant paths. The primary benefits of CLS compliance include seamless integration of components across languages, reducing the need for wrappers or adapters—for example, allowing a C++ DLL exposing CLS-compliant types to be directly callable from C# applications. This fosters , enhances portability within the CLI ecosystem, and supports consistent tool and framework behavior. In contrast to the full CTS, which encompasses a comprehensive type system including niche features like variants, low-level pointers, and global statics for all CLI languages, CLS deliberately excludes these to prioritize broad compatibility and excludes them from public visibility.

Metadata and Assemblies

In the Common Language Infrastructure (CLI), metadata serves as a comprehensive, language-independent description of program elements, stored in a binary format within Portable Executable/Common Object File Format (PE/COFF) files. This format consists of a contiguous block containing multiple streams, such as the main metadata stream (#~), string heaps (#Strings and #US for user strings), blob heaps for binary data, and GUID heaps, all indexed using compressed integers and metadata tokens for efficient access. The logical structure is organized into 39 tables that define types, members, attributes, and relationships, including the TypeDef table for class and interface definitions, MethodDef for method signatures, Field for instance variables, and custom attributes for additional metadata like security permissions. These tables support runtime features such as reflection, which allows dynamic inspection of types and members, and late binding, where method calls are resolved at execution time based on metadata tokens rather than direct addresses. Assemblies in the CLI represent the fundamental units of deployment, versioning, and , encapsulating , , and resources into logical groupings that can be single-file or multi-file configurations. Each assembly includes a manifest, stored in the Assembly table, which specifies the assembly's identity through elements like name, (major, minor, build, and revision numbers), , public key (if strongly named), and dependencies on other assemblies via AssemblyRef entries. Strong-named assemblies employ a public/private key pair and a cryptographic hash (typically ) to ensure unique identification and integrity, preventing tampering by verifying the against the assembly's contents, whereas weak-named assemblies rely solely on simple name and without cryptographic protection. Key elements within assemblies include embedded () alongside , resources listed in the ManifestResource table for non- data like images or strings, and support for satellite assemblies as multi-file extensions that provide localized resources based on -specific variants. The and structures play a pivotal role in enabling just-in-time () compilation and processes by supplying a complete, self-contained program description that obviates the need for . During compilation, the uses metadata tables to resolve types, lay out for objects, and generate native from CIL instructions, while leverages the metadata to enforce , check operand stacks, and ensure compliance with the without executing untrusted . implications arise primarily through strong naming's digital signatures, which detect modifications to the , and declarative attributes in the DeclSecurity , which define permissions like demands to mitigate risks such as unauthorized or buffer overflows. This design ensures that assemblies can be loaded and executed securely across diverse CLI implementations, promoting and robustness.

Common Intermediate Language (CIL)

The (CIL), also known as (MSIL), is a stack-based, object-oriented that serves as the platform-agnostic for the Common Language Infrastructure (CLI). It provides a low-level, human-readable representation of program logic, compiled from high-level languages, and is designed to be verifiable and executable on any CLI-compliant implementation regardless of the underlying hardware or operating system. CIL instructions operate on an evaluation stack, managing data through push and pop operations, and incorporate object-oriented features such as calls and type references via tokens. High-level languages compile to CIL through language-specific compilers, generating a sequence of instructions stored within method bodies in assemblies alongside embedded metadata that describes types, methods, and signatures. This process ensures that the resulting is portable and self-describing, with CIL code forming a contiguous stream of opcodes and operands encoded in a platform-independent format. For instance, compilers emit instructions using tools like ILAsm, which assemble text-based CIL into binary form suitable for assembly files. CIL features an extensive instruction set comprising over 200 opcodes, categorized by operand types such as inline none, inline , inline target, and short inline to optimize encoding efficiency. Arithmetic operations include instructions like add for and mul for , which pop two values from the , perform the computation, and push the result. is handled by opcodes such as br for unconditional branches and switch for multi-way branches based on values. Object-oriented operations encompass newobj for instantiating objects via constructors, callvirt for virtual method invocations on references, and field access instructions like ldfld and stfld. Additional features include structured with opcodes supporting try-catch-finally blocks (e.g., throw, endfinally), custom attributes via the .custom directive for annotations, and local management through the .locals directive along with load/store opcodes like ldloc and stloc, which ensure initialized variables for . Verification of CIL code enforces type safety by analyzing the instruction stream against metadata to prevent invalid operations, such as type mismatches or unauthorized memory access, while simulating stack states to confirm consistency across control flows. This process rejects unverifiable code that could lead to security vulnerabilities or runtime errors, though exceptions may be granted for trusted environments. Over successive standards, CIL has evolved to include optimizations like the tail. prefix for tail calls on instructions such as call and callvirt, enabling stack frame reuse for efficient recursion without increasing stack depth.

Execution Model

Virtual Execution System (VES)

The Virtual Execution System (VES) serves as the core runtime engine within the Common Language Infrastructure (CLI), providing an abstract specification for loading, verifying, and executing programs compiled to (CIL). It acts as a that ensures portability across different hardware architectures and operating systems by managing the execution of managed code in a controlled . The VES processes CIL as its primary input, converting it into executable form while enforcing the CLI's and metadata-driven model. The VES bears primary responsibilities for assembly loading, where it resolves and loads executable modules based on metadata references; CIL-to-native compilation using just-in-time (JIT) or ahead-of-time (AOT) mechanisms to generate machine-specific code; initiation of collection to manage for managed objects; and to handle concurrent execution within a shared . These functions enable the VES to support both managed code, which runs under its supervision, and managed data, which adheres to the (CTS). For instance, during assembly loading, the VES verifies file integrity by recomputing hash values before access. In the execution pipeline, the VES first performs to ensure of the CIL code, preventing invalid operations that could compromise or stability. It then resolves references to locate types, , and members dynamically during execution. Finally, it invokes the program's , such as the Main method marked in the assembly , to begin application execution, while maintaining method states via pointers, stacks, and local variables. This pipeline supports an stack model for operand handling, with CIL instructions loading and storing values as needed. As an abstract specification rather than a , the VES defines a standardized that allows vendors flexibility in realization, such as choosing specific compilers or interpreters without mandating details like collection algorithms. I of the CLI standard further elaborates this by specifying the hosting model for embedding the VES in applications, application domains for isolating execution , and context policies for managing object boundaries and remoting via proxies. Application domains, for example, enable multiple isolated environments within a single process, supported in full CLI profiles but optional in compact ones. Compliant runtimes have extended VES capabilities to include native AOT , which pre-compiles CIL to native at deployment time for improved startup performance and reduced runtime footprint, as implemented in .NET 7 and later. Similarly, support for allows VES execution in browser environments through AOT-compiled CIL targeting the WebAssembly virtual machine, enabling CLI-compliant applications in web contexts via runtimes like those in WebAssembly. These extensions maintain CLI standards while adapting to modern deployment scenarios.

Runtime Services

The runtime services in the Common Language Infrastructure (CLI) encompass the managed utilities provided by the Virtual Execution System (VES) to facilitate reliable and efficient execution of managed code, including automatic , concurrency support, error handling, and diagnostic capabilities. These services operate atop the (CIL) and metadata, abstracting platform-specific details to enable cross-language and developer productivity. As specified in the CLI standard, the VES orchestrates these services to ensure that managed applications receive consistent behavior across compliant implementations. Garbage collection serves as the primary mechanism for automatic memory management in the CLI, where the VES allocates heap space for managed objects and reclaims from unreachable instances to prevent leaks. The requires a garbage collector to automatically manage for managed objects, though specific algorithms are implementation-defined. Implementations often employ tracing collectors that identify live objects and may compact the using techniques like mark-and-sweep to minimize pauses and fragmentation. For example, in Microsoft's .NET runtime, the collector divides the into three generations (0 for short-lived objects, 1 for medium-lived, and 2 for long-lived) to prioritize collection of newer allocations for better throughput, with a separate large object handling allocations exceeding 85,000 bytes. Configurability options in such implementations, such as workstation mode for latency-sensitive client applications or server mode for high-throughput scenarios, allow tuning based on workload demands. Threading and synchronization in the CLI enable concurrent execution through managed threads created via the System.Threading.Thread class, with the VES enforcing a memory model that guarantees visibility of operations across threads. Synchronization primitives include the Monitor class for acquiring locks and ensuring mutual exclusion, as well as attributes like MethodImplAttributes.Synchronized for method-level protection. Thread pools, managed by System.Threading.ThreadPool, efficiently reuse worker threads for short-lived tasks, reducing overhead from frequent thread creation. Asynchronous programming is supported via delegates with BeginInvoke and EndInvoke methods, evolving into higher-level abstractions like tasks in the System.Threading.Tasks namespace, which underpin patterns such as async/await for non-blocking operations. Structured exception handling provides robust error recovery, utilizing try-catch-finally blocks along with optional fault and filter clauses, where exceptions derive from System.Exception and propagate via a handler table in metadata. The finally clause ensures cleanup code executes regardless of exception occurrence, implemented through CIL instructions like endfinally and enforced during stack unwinding. Debugging facilities rely on metadata extensions for symbol information and source mapping, often stored in formats like PDB files, with CIL's break instruction enabling runtime breakpoints. Remoting facilitates cross-context communication via proxies derived from System.MarshalByRefObject and channels for marshaling calls between application domains, though this mechanism has been deprecated in favor of alternatives like WCF or gRPC in contemporary frameworks. Application domains act as lightweight isolation boundaries within a single operating system , encapsulating assemblies for independent versioning, loading, and unloading to support dynamic code management without full restarts. Each domain maintains its own and execution context, preventing direct reference sharing across boundaries to enforce . Over time, this model has evolved in implementations toward -level , as seen in , where app domains are no longer supported in favor of containerized or separate for enhanced and simplicity. Performance enhancements include APIs in the System.Diagnostics namespace for and tiered , which initially JIT-compiles methods for quick startup before applying optimizations based on execution profiles.

Security and Verification

The Common Language Infrastructure (CLI) incorporates a robust security model outlined primarily in Partition I of the ECMA-335 standard, emphasizing verification and access () to protect against unauthorized operations during execution. verification involves a static analysis of () and associated metadata to enforce stack discipline, type rules, and , ensuring that cannot access memory outside its logical address space. This process mechanically examines CIL instructions for compliance, rejecting unverifiable —such as that involving unmanaged pointers or invalid branches—unless the execution environment explicitly permits it, thereby preventing buffer overflows and other violations. Every verified program is guaranteed to be memory-safe, as the verifier is conservative and errs on the side of caution. Code access security (CAS) in the CLI extends this foundation by implementing an evidence-based permission system, where the host environment provides evidence—such as code origin (e.g., zone or ), digital signatures, or strong names—to determine levels and assign corresponding permissions. Permissions are enforced through runtime stack walks, which traverse the call stack to verify that all callers possess the required access rights for sensitive operations, using actions like , Assert, or Deny. This model supports partial trust scenarios, allowing code to execute with restricted privileges in sandboxed environments, while full trust grants unrestricted access. Additional features include linker demands, which perform security checks during assembly linking (e.g., via LinkDemand ), and declarative security attributes stored in metadata tables like DeclSecurity, enabling permissions to be specified at the assembly, type, or method level using directives such as .permission or custom attributes. The CLI's Partition I defines a flexible trust model where security policies map evidence to permission sets, with the host providing critical evidence to assess code trustworthiness and enforce granular controls. However, in modern implementations like .NET Core and .NET 5+, has been deprecated due to its complexity, performance overhead, and vulnerability to "fail-open" exploits, where policy misconfigurations could grant excessive privileges. Related APIs, such as SecurityPermissionAttribute and EvidenceBase, are now marked obsolete with warnings, and the runtime no longer honors annotations or policies. Instead, developers are directed to rely on operating system-level sandboxing mechanisms, such as Windows AppContainers for or container technologies like , to enforce boundaries more reliably and portably across platforms. This shift prioritizes host environment controls over runtime-enforced permissions, aligning CLI executions with broader ecosystem practices.

Implementations

Microsoft Implementations

's primary implementation of the Common Language Infrastructure (CLI) began with the .NET Framework, released in 2002 as a Windows-only platform for building and running managed applications. It provided a full (CLR) with deep integration into the Windows ecosystem, including support for (COM) interop to enable seamless interaction between managed .NET code and unmanaged COM components or DLLs. The .NET Framework evolved through multiple versions, culminating in 4.8.1 released in August 2022, after which shifted focus to modern alternatives while continuing security updates for existing installations. In 2016, introduced .NET Core as a modular, cross-platform evolution of the CLI, supporting Windows, , and macOS to address the limitations of the Windows-centric .NET Framework. This implementation open-sourced the Core CLR in November 2014 under the .NET Foundation, fostering community contributions and enabling broader adoption beyond Windows. .NET Core unified with the .NET Framework's libraries under the single .NET branding starting with .NET 5 in 2020, emphasizing a streamlined for cloud-native and containerized applications. Recent releases include .NET 8 in November 2023 as a (LTS) version, .NET 9 in November 2024 as a standard-term support (STS) version, and .NET 10 in November 2025 as an LTS version, all enhancing CLI compliance with features like Native AOT compilation for ahead-of-time execution and trimming to reduce deployment sizes by removing unused code. Key advancements in Microsoft's CLI implementations include the , introduced in 2013 as a high-performance just-in-time () compiler for x64 architectures, which doubled compilation speed and improved runtime efficiency in both .NET Framework and .NET Core. For , Span provides a type-safe view over contiguous regions, enabling zero-allocation operations on arrays, strings, or unmanaged buffers to boost performance in high-throughput scenarios. Additionally, .NET Multi-platform App UI (), released in 2022, extends CLI support for cross-device applications across mobile (, ) and (Windows, macOS) platforms from a single codebase. These features align with CLI standards by optimizing the Virtual Execution System for diverse environments. The runtime components of .NET, including Core CLR, are licensed under the permissive , while some framework libraries and tools use the Apache 2.0 license, allowing free use, modification, and distribution with minimal restrictions. This licensing model supports Microsoft's goal of an open, extensible CLI ecosystem.

Open-Source and Third-Party Implementations

The Mono project, launched in June 2001 by under Ximian, represents a pioneering open-source implementation of the Common Language Infrastructure (CLI) and associated standards like C#, enabling .NET applications on non-Windows platforms such as . Its first milestone, running a "Hello World" program, occurred in August 2001, followed by the self-hosting C# in March 2002 and the stable 1.0 release in June 2004, which included a full , class libraries, and support for and . Sponsored by starting in 2004, Mono expanded to mobile platforms via (acquired by in 2016), joining the .NET Foundation that year to foster community-driven enhancements. In August 2024, transferred Mono's stewardship to WineHQ for ongoing maintenance, as its core technologies merged into the unified .NET from .NET 7 onward, while retaining legacy use in areas like game engines. Mono's contributions include optimizations for and systems, full CLI compliance for cross-platform execution, and extensions for and via just-in-time () and ahead-of-time (AOT) compilation modes. Xamarin, an open-source mobile development framework built atop Mono, leverages the CLI to allow shared C# codebases for native , , and Windows apps, launched in May 2011 with its Forms UI toolkit for declarative interfaces. Following Microsoft's 2016 acquisition, Xamarin evolved into .NET Multi-platform App UI () with .NET 6 in November 2021, unifying mobile and desktop (macOS, Windows) development under a single project structure that compiles CLI assemblies to platform-native binaries. .NET enhances CLI portability by abstracting UI rendering and handlers, supporting hot reload and single-project multi-targeting for streamlined builds across ecosystems. Among other third-party efforts, DotGNU's Portable.NET, initiated in 2001 as part of the GNU project, provided an early free-software CLI implementation with compilers for C# and Visual Basic .NET, a runtime supporting architectures like x86, ARM, and PowerPC, and base class libraries for XML and Windows.Forms compatibility on Linux, BSD, and other Unix variants. Development peaked with version 0.8.0 in March 2007, including JIT and interpreter modes, but halted around 2009 due to resource constraints, leaving it as a discontinued but influential prototype for standards-compliant CLI portability. Similarly, CoreRT, an experimental open-source .NET Core runtime introduced by Microsoft in 2016, focused on AOT compilation of CLI code into native executables for embedded and size-constrained environments, producing single-file binaries without a runtime dependency. Archived in November 2020 after integration into broader .NET efforts, CoreRT paved the way for Native AOT features in .NET 7, emphasizing CLI optimizations for non-JIT scenarios like IoT devices. Unity's IL2CPP (Intermediate Language to C++) scripting backend, introduced in 2015, functions as a third-party AOT tool that transpiles CLI from C# scripts into C++ source, then compiles it to native code for platforms restricting , such as , consoles, and . This approach boosts runtime performance in game development by avoiding overhead, while maintaining CLI for and generics, and supports incremental builds on select platforms to reduce times. These implementations have driven CLI adoption beyond Windows through community-led bug fixes, such as Mono's runtime stability improvements for compliance, performance enhancements like optimizations in Xamarin, and ecosystem extensions enabling .NET on and systems, ultimately shaping the cross-platform focus of modern .NET.

Compatibility and Interoperability

The Common Language Infrastructure (CLI) promotes standards-based compatibility through defined conformance profiles in the ECMA-335 specification, enabling subset implementations tailored to specific environments such as desktop or server systems. These profiles, including the Kernel Profile for minimal functionality and the Compact Profile for resource-constrained devices, allow implementations to support a core set of libraries while excluding advanced features like reflection or remoting if not required. Desktop and server profiles extend these subsets to include broader capabilities, such as layout control and metadata merging, ensuring that conforming systems can execute CLI-compliant code without altering standardized interfaces.
ProfileKey FeaturesTypical Use Case
Kernel ProfileBase Class Library and Runtime Infrastructure; excludes floating-point ops, , and remotingMinimal, systems
Compact ProfileExtends Kernel with XML, Network, and Resource-rich mobile devices
Desktop ProfileIncludes common CLI features like and layout controlGeneral applications
Server ProfileEmphasizes with merging for global methods/fields environments
CLI versioning mechanisms facilitate consistent behavior across updates by supporting assembly binding redirects, side-by-side installation, and semantic versioning practices in implementations. Binding redirects, configured via application or machine configuration files, allow runtime resolution of version conflicts by mapping references from older to newer assembly versions, preventing errors like FileLoadException during dependency updates. Side-by-side execution enables multiple .NET Framework versions (e.g., 1.1 and 2.0) to coexist on the same system, with strong-named assemblies stored in the Global Assembly Cache to isolate resources by version, culture, and publisher. Semantic versioning, following the major.minor.patch format, is adopted in .NET ecosystems for package management, ensuring backward compatibility within minor releases while signaling breaking changes in major versions. Cross-implementation compatibility in the CLI is achieved through binary-level support between frameworks like .NET Framework and .NET Core, often via compatibility shims, though challenges arise with deprecated features. The .NET Standard 2.0 compatibility mode provides a shim layer allowing .NET Framework libraries to be referenced in .NET Core projects, covering a significant surface but excluding Windows-specific elements like certain Win32 dependencies. Packages such as .Windows.Compatibility act as shims to polyfill missing .NET Framework in cross-platform scenarios. However, features like , deprecated since .NET Framework 4.0 and removed in .NET Core, pose migration issues, as CAS policies are not honored and must be replaced with OS-level security models. Interop with native code is a core CLI capability, enabling seamless integration with non-CLI systems through mechanisms like P/Invoke for Win32 APIs, COM marshalling, and foreign function interfaces (FFI) in cross-platform contexts. P/Invoke uses attributes like [LibraryImport] to declare calls to unmanaged libraries (e.g., user32.dll on Windows or libc.so.6 on ), with automatic marshalling for types such as strings and structs via [StructLayout]. COM interop supports bidirectional communication, where managed objects can be exposed as COM servers or consume components through runtime-generated proxies and stubs for data marshalling across boundaries. In cross-platform FFI scenarios, CLI implementations handle platform differences, such as calling getpid from libSystem.dylib on macOS, ensuring portable native access without recompilation. Testing CLI compatibility relies on the Common Type System (CTS) conformance tests outlined in Partition VI of ECMA-335, which validate implementation adherence through sample ILAsm programs and portability annexes. These tests cover CTS rules for , , and verifiable , including annexes on sample generics, custom attributes, and imprecise faults to ensure consistent behavior. Real-world issues often stem from platform-specific behaviors, such as varying file path conventions (e.g., backslashes on Windows versus forward slashes on systems) or native integer sizes (32-bit versus 64-bit), which can lead to portability errors in unmanaged interop or data alignment. For instance, array padding and string marshalling may differ by , requiring explicit handling in cross-platform to avoid runtime failures. CLS rules from the CLI core components further aid language-level interop by enforcing compliant types and signatures across implementations.

References

  1. [1]
    ECMA-335 - Ecma International
    Common Language Infrastructure (CLI) - Defines the infrastructure in which applications written in multiple high-level languages can be executed.
  2. [2]
    Introduction - C# language specification - Microsoft Learn
    Another Task Group, TG3, was also formed at that time to produce a standard for a library and execution environment called Common Language Infrastructure (CLI).
  3. [3]
    ISO/IEC 23271:2012 - Common Language Infrastructure (CLI)
    In stockISO/IEC 23271:2012 defines the Common Language Infrastructure (CLI) in which applications written in multiple high-level languages can be executed in different ...
  4. [4]
    None
    Below is a merged summary of the historical information on the origins and development of the Common Language Infrastructure (CLI) based on the provided segments. To retain all details efficiently, I’ve organized the information into a dense, tabular format in CSV style, followed by a concise narrative summary that integrates the key points. This approach ensures all information is preserved while maintaining clarity and avoiding redundancy.
  5. [5]
    Common Language Runtime (CLR) overview - .NET - Microsoft Learn
    The Common Language Runtime (CLR) is a .NET runtime environment that runs code and provides services, enabling managed code with features like cross-language ...
  6. [6]
    Ecma standards for .NET - Microsoft Learn
    The Common Language Infrastructure: ECMA-335.pdf. Information Derived from the Partition IV XML File: ECMA TR/84 format. The official ISO/IEC documents are ...
  7. [7]
    [PDF] ECMA-335, 6th edition, June 2012
    The presentation of the rules for assignment compatibility (§I.8.7, §III.1.8.1.2.3) has been extensively revised to a more precise and clearer ...
  8. [8]
    Microsoft Unveils Vision for Next Generation Internet - Source
    Jun 22, 2000 · This new family of Microsoft .NET products and technologies replaces the previous working title of Next Generation Windows Services (NGWS) ...
  9. [9]
    ECMA Standardizes Key .NET Technologies - Source - Microsoft News
    Dec 13, 2001 · Microsoft submitted the specifications for C# and CLI to ECMA in October 2000, and has collaborated with a dozen industry leaders, including ...
  10. [10]
    JVM versus CLR: a comparative study. - ResearchGate
    We present empirical evidence to demonstrate that there is little or no difference between the Java Virtual Machine and the . ... inspired by the programming ...
  11. [11]
    ISO/IEC 23271:2003 - Common Language Infrastructure
    ISO/IEC 23271:2003 defines the Common Language Infrastructure (CLI) in which applications written in multiple high-level languages may be executed in ...
  12. [12]
    ScottGu's Blog - Announcing Open Source of .NET Core Framework ...
    Earlier this year, at the Build 2014 conference, I announced the creation of the .NET Foundation – which is an independent organization ...
  13. [13]
    [PDF] ECMA-335, 5th edition, December 2010
    This International Standard defines the Common Language Infrastructure (CLI) in which applications written in multiple high-level languages can be executed ...
  14. [14]
    Language independence and language-independent components
    Dec 20, 2022 · The Common Language Specification is defined in Partition I, Clauses 7 through 11 of the ECMA-335 Standard: Common Language Infrastructure.
  15. [15]
  16. [16]
  17. [17]
    Native AOT deployment overview - .NET | Microsoft Learn
    Publish Native AOT using the CLI. Add <PublishAot>true</PublishAot> to your project file. This property enables Native AOT compilation during publish. It ...Optimizing AOT deployments · Known trimming incompatibilitiesMissing: WebAssembly | Show results with:WebAssembly
  18. [18]
  19. [19]
    Fundamentals of garbage collection - .NET | Microsoft Learn
    In the common language runtime (CLR), the garbage collector (GC) serves as an automatic memory manager. The garbage collector manages the allocation and ...Missing: ECMA- 335 Infrastructure
  20. [20]
    Compilation config settings - .NET - Microsoft Learn
    Tiered compilation · The first tier generates code more quickly (quick JIT) or loads pre-compiled code (ReadyToRun). · The second tier generates optimized code in ...Missing: Infrastructure | Show results with:Infrastructure
  21. [21]
    Most code access security APIs are obsolete - .NET - Microsoft Learn
    Learn about the .NET 5 breaking change in core .NET libraries where most code access security (CAS)-related types in .NET are now obsolete as warning.
  22. [22]
    NET Framework technologies unavailable on .NET 6+
    Feb 14, 2024 · Several technologies available to .NET Framework libraries aren't available for use with .NET 6+, such as app domains, remoting, and code access security (CAS).
  23. [23]
    Microsoft .NET Framework - Microsoft Lifecycle
    Releases ;.NET Framework 4.8.1, Aug 9, 2022 ;.NET Framework 4.8, Apr 18, 2019 ;.NET Framework 4.7.2, Apr 30, 2018 ;.NET Framework 4.7.1, Oct 17, 2017.
  24. [24]
    Interoperating with unmanaged code - .NET Framework
    ### Summary of COM Interop in .NET Framework
  25. [25]
    NET Core is Open Source - Microsoft Developer Blogs
    Nov 12, 2014 · NET Core will be open source, including the runtime as well as the framework libraries. This is a natural progression of our open source efforts ...
  26. [26]
    Introduction to .NET - .NET
    ### Summary of .NET Core / .NET Details
  27. [27]
    The official .NET support policy
    The .NET platform is officially supported by Microsoft. Microsoft ships official releases that are built and tested on Microsoft-maintained servers in Azure.NET and .NET Core support... · Icy/dotnet-framework · NET Native release and...
  28. [28]
    RyuJIT: The next-generation JIT compiler for .NET
    Sep 30, 2013 · A new, next-generation x64 JIT compiler that compiles code twice as fast is ready to change your impressions of 64-bit .NET code.
  29. [29]
    Memory-related and span types - .NET - Microsoft Learn
    Jul 13, 2024 · Span<T>, a type that's used to access a contiguous region of memory. A Span<T> instance can be backed by an array of type T , a buffer allocated ...Missing: efficiency | Show results with:efficiency
  30. [30]
    .NET Multi-platform App UI (.NET MAUI) | .NET
    NET MAUI is a framework used to build native, cross-platform desktop and mobile apps from a single C# codebase for Android, iOS, Mac, and Windows.One Codebase · Build Beautiful Apps, Faster · Everything You Need For Your...
  31. [31]
    .NET is open source on GitHub | .NET
    The various parts of .NET are maintained in different GitHub repositories. These repositories typically use the MIT or Apache 2 licenses. Some repositories ...
  32. [32]
    Trim self-contained applications - .NET - Microsoft Learn
    The trim-self-contained deployment model is a specialized version of the self-contained deployment model that is optimized to reduce deployment size.
  33. [33]
    History - Mono Project
    Jan 3: Mono's C# compiler can bootstrap itself using the .NET runtime. The next stage is to get it bootstrapping with the Mono runtime. Jan 4: Mono gains ...
  34. [34]
    About Mono
    Mono, the open source development platform based on the .NET Framework, allows developers to build cross-platform applications with improved developer ...Missing: history | Show results with:history
  35. [35]
    News - WineHQ now hosting Mono
    Sep 17, 2024 · September 17, 2024. The Wine team is proud to announce that WineHQ has officially taken over hosting and maintenance of the Mono Project ... mono ...Missing: transferred | Show results with:transferred
  36. [36]
    Mono open source ECMA CLI, C# and .NET implementation. - GitHub
    Mono is a software platform designed to allow developers to easily create cross platform applications. It is an open source implementation of Microsoft's .NET ...Mono Project · Issues 2.2k · Pull requests 100 · DiscussionsMissing: domains | Show results with:domains
  37. [37]
  38. [38]
  39. [39]
    This repo contains CoreRT, an experimental .NET Core runtime ...
    Nov 1, 2020 · The CoreRT compiler can compile a managed .NET Core application into a native (architecture specific) single-file executable that is easy to ...
  40. [40]
    Unity - Manual: IL2CPP Overview
    ### Summary of IL2CPP as a Scripting Backend for Unity
  41. [41]
    Redirecting Assembly Versions - .NET Framework - Microsoft Learn
    You can use the appliesTo attribute on the <assemblyBinding> element in an app configuration file to redirect assembly binding references to a specific version ...Missing: side- side
  42. [42]
    Side-by-Side Execution in the .NET Framework - Microsoft Learn
    Sep 15, 2021 · You can redirect assembly binding to include other versions of the .NET Framework assemblies, but overriding the default assembly binding can be ...Missing: CLI | Show results with:CLI
  43. [43]
    Port from .NET Framework to .NET - .NET Core - Microsoft Learn
    Sep 16, 2025 · This article provides an overview of what you should consider when porting your code from .NET Framework to .NET (formerly named .NET Core).The Future Of . Net Standard · Github Copilot App... · . Net Upgrade Assistant
  44. [44]
    Platform Invoke (P/Invoke) - .NET - Microsoft Learn
    May 10, 2024 · P/Invoke is a technology that allows you to access structs, callbacks, and functions in unmanaged libraries from your managed code.