CilTools.BytecodeAnalysis
2.5.0
See the version list below for details.
dotnet add package CilTools.BytecodeAnalysis --version 2.5.0
NuGet\Install-Package CilTools.BytecodeAnalysis -Version 2.5.0
<PackageReference Include="CilTools.BytecodeAnalysis" Version="2.5.0" />
paket add CilTools.BytecodeAnalysis --version 2.5.0
#r "nuget: CilTools.BytecodeAnalysis, 2.5.0"
// Install CilTools.BytecodeAnalysis as a Cake Addin #addin nuget:?package=CilTools.BytecodeAnalysis&version=2.5.0 // Install CilTools.BytecodeAnalysis as a Cake Tool #tool nuget:?package=CilTools.BytecodeAnalysis&version=2.5.0
CilTools.BytecodeAnalysis
Requirements: .NET Framework 3.5+ or .NET Standard 2.0+
CilTools.BytecodeAnalysis reads .NET methods' Common Intermediate Language (CIL) bytecode and converts it into high-level objects or textual CIL representation so they can be easily studied and programmatically processed. See Documentation and Examples for more information.
Usage
- Import
CilTools.BytecodeAnalysis
namespace - Use CilReader.GetInstructions to get the collection of instructions from method
- Use CilGraph.Create to get a graph that represents a flow of control between method's instructions
- Use CilAnalysis.MethodToText when you need to output method's CIL code as text
- CilTools.BytecodeAnalysis.Extensions namespace provides an alternative syntax via extension methods
Example
using System;
using System.Collections.Generic;
using CilTools.BytecodeAnalysis;
using CilTools.BytecodeAnalysis.Extensions;
namespace CilToolsExample
{
class Program
{
public static void Hello()
{
int a = 1;
int b = 2;
Console.WriteLine("Hello, World");
Console.WriteLine("{0} + {1} = {2}",a,b,a+b);
}
static void Main(string[] args)
{
IEnumerable<CilInstruction> instructions = typeof(Program).GetMethod("Hello").GetInstructions();
foreach (CilInstruction instr in instructions)
{
Console.WriteLine(instr.ToString());
}
Console.ReadKey();
}
}
}
/* Output:
nop
ldc.i4.1
stloc.0
ldc.i4.2
stloc.1
ldstr "Hello, World"
call void [mscorlib]System.Console::WriteLine(string)
nop
ldstr "{0} + {1} = {2}"
ldloc.0
box [mscorlib]System.Int32
ldloc.1
box [mscorlib]System.Int32
ldloc.0
ldloc.1
add
box [mscorlib]System.Int32
call void [mscorlib]System.Console::WriteLine(string, System.Object, System.Object, System.Object)
nop
ret
*/
Copyright (c) 2022, MSDN.WhiteKnight
Product | Versions 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 was computed. 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. |
.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 | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. 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. |
-
.NETFramework 3.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on CilTools.BytecodeAnalysis:
Package | Downloads |
---|---|
CilTools.Runtime
CilTools.Runtime reads Common Intermediate Language (CIL) bytecode of methods in external process's CLR instance using ClrMD. |
|
CilTools.Metadata
The library that supports inspecting the contents of .NET assembly via reflection without loading it into the current process |
|
CilTools.SourceCode
Provides APIs that assist in lexical analysis of source code in various programming languages |
|
CilTools.Visualization
Provides APIs that visualize syntax trees |
GitHub repositories
This package is not used by any popular GitHub repositories.