ILReader.Core 1.0.0.6

dotnet add package ILReader.Core --version 1.0.0.6
                    
NuGet\Install-Package ILReader.Core -Version 1.0.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ILReader.Core" Version="1.0.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ILReader.Core" Version="1.0.0.6" />
                    
Directory.Packages.props
<PackageReference Include="ILReader.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ILReader.Core --version 1.0.0.6
                    
#r "nuget: ILReader.Core, 1.0.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ILReader.Core@1.0.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ILReader.Core&version=1.0.0.6
                    
Install as a Cake Addin
#tool nuget:?package=ILReader.Core&version=1.0.0.6
                    
Install as a Cake Tool

CIL-Reader for Methods(e.g. dynamic) and Delegates

Common Intermediate Language reader, analyzer and visualizer tool.
Allows you to access CIL-instructions of .Net method's bodies.

Core Library (ILReader.Core)

Provides a way to read and interprete CIL-bytes of methods and delegates bodies.

Usage:

var method = typeof(...).GetMethod(...);
// or
var method = delegate.Method;
// or
var method = (DynamicMethod)(/* create or get method */);

Get Reader:

IILReader GetReader(MethodBase method) {
    IILReaderConfiguration cfg = Configuration.Resolve(method);
    return reader = cfg.GetReader(method);
}

Iterate instructions one-by-one:

foreach(IInstruction instruction in reader) {
    var opCode = instruction.OpCode
    object operand = instruction.Operand;
    int ILOffset = instruction.Offset;
    // ...
}

Assembly-level reading via System.Reflection.Metadata

Read IL from any .NET assembly PE stream without loading it into the CLR:

using var stream = File.OpenRead("MyAssembly.dll");
IILReaderConfiguration cfg = Configuration.ForAssembly(stream);

// by metadata token
IILReader reader = cfg.GetReader(method.MetadataToken);

// or by type and method name
IILReader reader = cfg.GetReader("My.Namespace.MyClass", "MyMethod");

foreach(IInstruction instruction in reader) {
    // operands are IMetadataSymbol — use GetSource<T>() or TryGetSource<T>()
    if(instruction.Operand is IMetadataSymbol sym)
        Console.WriteLine($"{instruction.OpCode} {sym.Name} ({sym.Kind})");
}

Visualizer Library (ILReader.Visualizer)

Debugger Visualizer for Visual Studio. Provides a way to view CIL-bytes of methods and delegates bodies.

Usage:

Func<...> someFunc = ...; // Just use it while debugging

Analyzer Library (ILReader.Analyzer)

Provides a way to detect typical patterns in CIL-bytes.

Usage:

class Bar {
    public void Stub() {
        throw new NotImplementedException("Stub");
    }
}

Check whether or not the method's body match pattern:

var method = typeof(Bar).GetMethod("Stub");
var reader = GetReader(method);
// use default pattern or create you own
var pattern = Analyzer.NotImplemented.Instance;
if (pattern.Match(reader)) {
    // do something
}

Real usage

NuGet

To install ILReader.Core, run the following command in the Package Manager Console:

Install-Package ILReader.Core

License

The ILReader.Core library is licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ILReader.Core:

Package Downloads
ILSA.Core

Library for creating simple static analysis(SA) diagnostics and analyzing .Net assemblies at the IL-code level.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.6 110 4/26/2026
1.0.0.5 273 2/15/2026
1.0.0.4 1,424,309 1/8/2023

v1.0.0.6
- SRM engine: read IL from any .NET assembly PE stream via Configuration.ForAssembly(Stream)
- IMetadataSymbol abstraction: unified typed access to method, field, type, and string operands
- IILReaderConfiguration: new GetReader(int metadataToken) and GetReader(typeName, methodName) overloads
- Extended test coverage: LocalSignatureReader types, ILBytesReader boundaries, exception handler shapes, numeric literal operands
- ARCHITECTURE.md: new architecture documentation
- Removed outdated DebuggerVisualizer projects