ILReader
MSIL Reader
Install / Use
/learn @DmitryGaravsky/ILReaderREADME
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.
<a href="https://www.nuget.org/packages/ILReader.Core/"><img alt="Nuget Version" src="https://img.shields.io/nuget/v/ILReader.Core.svg" data-canonical-src="https://img.shields.io/nuget/v/ILReader.Core.svg" style="max-width:100%;" /></a>
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;
// ...
}
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
- MSIL-level boxing detector tool for .Net
- Simple static analysis(SA) tool to analyze .Net assemblies at the IL-code level with visual client
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.
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
