What’s the difference between .NET CoreCLR, CoreRT, Roslyn and LLILC

Roslyn is a compiler platform that enables you to build static and dynamic analysis tools and custom language extensions and transformations for the C# and VB programming languages.It also enables you to embed these languages within other languages or applications. Roslyn includes the C# and VB compilers and other tools. These compilers emit Common Intermediate … Read more

Where is the .NET JIT-compiled code cached?

Memory. It can be cached, that’s the job of ngen.exe. It generates a .ni.dll version of the assembly, containing machine code and stored in the GAC. Which automatically gets loaded afterward, bypassing the JIT step. But that has little to do with why your program starts faster the 2nd time. The 1st time you have … Read more

Are there any .NET CLR/DLR implementations of ECMAScript?

Currently, I’ve modified a version of the EcmaScript.NET inside my YUICompressor.NET port (project). If you grab the source code from here, I’ve included my modified code in the project, which you can reference. This is the only source of code i’ve found in .NET which can handle parsing javascript, server side. Unfortunately, I can’t remember … Read more

How is it that an enum derives from System.Enum and is an integer at the same time?

Yes, special treatment. The JIT compiler is keenly aware of the way boxed value types work. Which is in general what makes value types acting a bit schizoid. Boxing involves creating a System.Object value that behaves exactly the same way as a value of a reference type. At that point, value type values no longer … Read more

Haskell for the .NET platform?

There’s no active work on porting the GHC runtime to .NET. F# is the closest thing, though be aware it is based on OCaml. One of the core differences is, that Haskell is always lazy, while OCaml and F# evaluate mostly strict, and lazy just in some special cases. There are many similarities besides that. … Read more

Equivalent of Class Loaders in .NET

The answer is yes, but the solution is a little tricky. The System.Reflection.Emit namespace defines types that allows assemblies to be generated dynamically. They also allow the generated assemblies to be defined incrementally. In other words it is possible to add types to the dynamic assembly, execute the generated code, and then latter add more … Read more

Asynchronous iterator Task

A more “batteries-included” implementation of this kind of thing, including language support, is now available as of C# 8.0. Now, when using at least C# 8.0 (or higher) with .NET Standard 2.1 (or higher) and/or .NET Core 3.0 (or higher), the code from the original question may be written as follows: private async IAsyncEnumerable<char> TestAsync(string … Read more