The Microsoft Shared Source CLI Implementation
Abortable Thread Pool
The Analytic Hierarchy Process
API Test Automation in .NET
Asynchronous HttpWebRequests, Interface Implementation, and More
Bad Code? FxCop to the Rescue
Basics of .NET Internationalization
Behind the Scenes: Discover the Design Patterns You're Already Using in the .NET Framework
BigInteger, GetFiles, and More
Binary Serialization of DataSets
Building Voice User Interfaces
Can't Commit?: Volatile Resource Managers in .NET Bring Transactions to the Common Type
CLR Inside Out: Base Class Library Performance Tips and Tricks
CLR Inside Out: Ensuring .NET Framework 2.0 Compatibility
CLR Inside Out: Extending System.Diagnostics
CLR Profiler: No Code Can Hide from the Profiling API in the .NET Framework 2.0
Concurrent Affairs: Build a Richer Thread Synchronization Lock
Custom Cultures: Extend Your Code's Global Reach With New Features In The .NET Framework 2.0
Cutting Edge: Collections and Data Binding
Const in C#, Exception Filters, IWin32Window, and More
Creating a Custom Metrics Tool
DataSets vs. Collections
Determining .NET Assembly and Method References
Experimenting with F#
File Copy Progress, Custom Thread Pools
Finalizers, Assembly Names, MethodInfo, and More
Got Directory Services?: New Ways to Manage Active Directory using the .NET Framework 2.0
High Availability: Keep Your Code Running with the Reliability Features of the .NET Framework
How Microsoft Uses Reflection
ICustomTypeDescriptor, Part 2
ICustomTypeDescriptor, Part 1
Iterating NTFS Streams
JIT and Run: Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects
Lightweight UI Test Automation with .NET
Low-Level UI Test Automation
Make Your Apps Fly with the New Enterprise Performance Tool
Managed Spy: Deliver The Power Of Spy++ To Windows Forms With Our New Tool
Memory Models: Understand the Impact of Low-Lock Techniques in Multithreaded Apps
Microsoft Java Virtual Machine Update
Microsoft .NET Framework Delivers the Platform for an Integrated, Service-Oriented Web, Part 2
Mini Dump Snapshots and the New SOS
Mutant Power: Create A Simple Mutation Testing System With The .NET Framework
NamedGZipStream, Covariance and Contravariance
.NET Internationalization Utilities
.NET Profiling: Write Profilers With Ease Using High-Level Wrapper Classes
No More Hangs: Advanced Techniques To Avoid And Detect Deadlocks In .NET Apps
The Perfect Host: Create and Host Custom Designers with the .NET Framework 2.0
Phoenix Rising
Scheme Is Love
Security Enhancements in the .NET Framework 2.0
Sepia Tone, StringLogicalComparer, and More
Software Testing Paradoxes
Stay Alert: Use Managed Code To Generate A Secure Audit Trail
Stream Decorator, Single-Instance Apps
StringStream, Methods with Timeouts
Tailor Your Application by Building a Custom Forms Designer with .NET
Test Harness Design Patterns
ThreadPoolPriority, and MethodImplAttribute
ThreadPoolWait and HandleLeakTracker
Three Vital FXCop Rules
A Tidal Wave of Change
To Confirm is Useless, to Undo Divine
Touch All the Bases: Give Your .NET App Brains and Brawn with the Intelligence of Neural Networks
Transactions for Memory
Trustworthy Software
Tune in to Channel 9
UDP Delivers: Take Total Control Of Your Networking With .NET and UDP
UI on the Fly: Use the .NET Framework to Generate and Execute Custom Controls at Run Time
Unexpected Errors in Managed Applications
Unhandled Exceptions and Tracing in the .NET Framework 2.0
Using Combinations to Improve Your Software Test Case Generation
Wandering Code: Write Mobile Agents In .NET To Roam And Interact On Your Network
What Makes Good Code Good?
XML Comments, Late-bound COM, and More
Collapse the table of content
Expand the table of content

The Microsoft Shared Source CLI Implementation


David Stutz
Microsoft Corporation

March 2002

Download the Shared Source CLI from the MSDN Download Center.

The Microsoft® Shared Source CLI Implementation is a file archive containing working source code for the ECMA-334 (C#) and ECMA-335 (Common Language Infrastructure, or CLI) standards. These standards together represent a substantial subset of what is available in the Microsoft .NET Framework. In addition to the CLI implementation and the C# compiler, the Shared Source CLI Implementation contains a cornucopia of tools, utilities, additional Framework classes, and samples. It will build and run on the Microsoft Windows® XP and the FreeBSD operating systems.

Wondrous Machine

The Microsoft Shared Source CLI Implementation, affectionately known as "Rotor" to those of us on the team building it, is a complete implementation of the ECMA-334 (C#) and ECMA-335 (CLI) standards in source code form. It's an amazing piece of software for those who love browsing or tinkering with programming language infrastructure. In its million-plus lines of source code, you will find compilers, tools, techniques for automatically managing memory, just-in-time (JIT) code generators, component and Web services infrastructure, globalization know-how, security protocols, and all sorts of other intriguing realizations of abstract concepts.

Microsoft has built the Shared Source CLI so that researchers, students, professors and other interested developers can teach, learn, and experiment with advanced computer language infrastructure. To achieve this goal, the source code to both the Windows XP and FreeBSD versions of the software has been released using the shared source approach to source code access. The license for the Shared Source CLI Implementation permits anyone to use or modify its code for non-commercial purposes.

Flexibility Is Standard

The ECMA-335 (CLI) standard describes a language-agnostic runtime engine that is capable of converting lifeless blobs of metadata into self-assembling, robust, and type-safe software systems. The managed components that populate these software systems can be written in any of a number of different computer languages, yet still interact robustly, and with high fidelity. The secret to this spirit of cooperation is the shared runtime infrastructure of the CLI, which includes not only low-level capabilities such as standardized metadata and intermediate language representation, but also high-level, productivity-related capabilities such as universally available class libraries. For the benefit of existing codebases, the CLI standard also takes pains to describe in detail how unmanaged software can co-exist safely with managed components, enabling seamless sharing of computing resources and responsibilities.

The authors of the CLI standard anticipate a world in which there will be multiple implementations of that standard, each supporting the same base set of features, but each also exposing unique capabilities such as additional frameworks, services, utilities, or language features. This is akin to the philosophy of C#'s progenitor, the C language and runtime. In a well-known set of papers and books from the early 1970s, Brian Kernighan and Dennis Ritchie documented their quest to strike the right balance between portability and type safety on the one hand, and expressive access to underlying hardware and software on the other. Like the C runtime, the CLI has been designed to exploit the power of diverse platforms, as well as to complement existing tools, languages, and runtimes.

The specification that describes the interface to this interoperability engine is voluminous; approaching it as an implementer can be daunting. Going beyond the standard, Microsoft realized that there needed to be at least one sample that shows how to create a working instance of this engine. The Shared Source CLI fills this gap, providing an implementation that demonstrates one way (but certainly not the only way) to build a portable, programming language-independent version of the CLI standard.

CLI Foundations

Please remember when you download the Shared Source CLI that it is an experimental and non-commercial implementation! The source code, although fairly stable, is of beta quality. We will be updating this drop, although we do not yet have dates for when updates might be expected. The development team will be lurking on NNTP at the microsoft.public.shared_source.cli newsgroup, and your feedback is desired. In addition, a Shared Source CLI-moderated discussion list has been created by the University of Pisa, and DevelopMentor is hosting a Shared Source CLI discussion group.

Let's look at a few of the likely ways that the Shared Source CLI Implementation might interest you:

  • There are significant differences in implementation between this code and the code for Microsoft's commercial CLR implementation, both to facilitate portability and to make the codebase more approachable. Nonetheless, if you are a developer who is interested in the gory details of virtualized object systems, of how to design object frameworks, of how JIT compilers and garbage collectors work, or of how Microsoft Visual Studio® works on your behalf under the covers, this distribution will definitely hold your attention!
  • If you are a teacher who is interested in creating courseware around interesting topics that can be illustrated by this codebase, or a researcher who is engaged in research or prototyping that would benefit from being built upon the foundation of this source code, this distribution will delight you. For example, individuals working with program-guided optimizations, such as data and code layout or code compaction, might use the reflection capabilities of the runtime to their advantage. Alternatively, a compiler internals course might reference the C#, Microsoft JScript®, or runtime JIT compilers as examples. The list of potential topics is literally huge.
  • Finally, if you are thinking about implementing your own version of the CLI, or if you need to understand more about the ways that compilers and tools can target Common Intermediate Language or the Base Class Libraries, this distribution will be an indispensable guide for you. The completeness of the offering, along with its liberal licensing terms, will make the Shared Source CLI both a valuable example and a test case for everyone.

As a member of the Rotor development team at Microsoft, I invite everyone to download this code, poke around, and have fun with it. The CLI standard will be important for years to come, and there is no better way to understand it fully than browsing and building these sources. We also hope that the availability of this code to researchers and teachers will provide a foundation for future innovation. The possibilities here are very broad—please share your ideas and results with us!

Additional Resources

You can read more about the Microsoft Shared Source CLI in MSDN Magazine.

© 2015 Microsoft