---
title: "Rewrite MSIL Code on the Fly"
url: "https://osherove.com/blog/2003/7/24/rewrite-msil-code-on-the-fly.md"
canonical: "https://osherove.com/blog/2003/7/24/rewrite-msil-code-on-the-fly.html"
published: "2003-07-24T13:48:00"
updated: "2003-07-24T13:48:00"
tags: [".Net Quotations"]
author: "Roy Osherove"
description: "\"Lately i've been spending my extra cycles on understanding the deep, dark secrets of the CLR . Between using cordbg as my primary debugger instead of Visual Studio , and writing a mini-profiler w/ the Allocation…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Rewrite MSIL Code on the Fly

By Roy Osherove July 24, 2003 In [.Net Quotations](https://osherove.com/blog/category/net-quotations)

**Historical article** · Originally published July 24, 2003; technical details may be outdated.

_"Lately i've been spending my extra cycles on understanding the deep, dark secrets of the_ [_CLR_](http://www.gotdotnet.com/team/clr/about_clr.aspx)_. Between using_ [_cordbg_](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptutorials/html/appendix_b__runtime_debugger_cordbg.asp) _as my primary debugger instead of_ [_Visual Studio_](http://www.microsoft.com/vstudio)_, and writing a mini-profiler w/ the Allocation Profiler API's, my head's just been swimming along in_ [_metadata_](http://msdn.microsoft.com/msdnmag/issues/1000/metadata/) _land._

_Then a brillant article that's in the upcoming_ [_September MSDN magazine_](http://msdn.microsoft.com/msdnmag/issues/03/09/default.aspx) _by_ [_Aleksandr Mikunov_](http://www.codeproject.com/script/profile/whos_who.asp?id=31976) _passed by me. Titled "Rewrite MSIL Code on the Fly with the .NET Framework Profiling API", it dives into the murky depths of code injection. There's more information from Alex on the subject in a companion article up on_ [_The Code Project_](http://www.codeproject.com/dotnet/model_constraints_in_net2.asp)_. Highly recommended reading."_

\[[The Furrygoat Experience](http://www.furrygoat.com/archives/000522.html)\]

Hey, no fair! The MSDN article isn't online yet :(

## More in .Net Quotations

[All posts in .Net Quotations](https://osherove.com/blog/category/net-quotations)

- Jul 27, 2003

    ### [Using XPath to find objects in your object model](https://osherove.com/blog/2003/7/27/using-xpath-to-find-objects-in-your-object-model.html)

- Jul 27, 2003

    ### [More on Modifying IL at runtime](https://osherove.com/blog/2003/7/27/more-on-modifying-il-at-runtime.html)

- Jul 22, 2003

    ### [Israel .NET Software Architects User Group Meeting - July 2003](https://osherove.com/blog/2003/7/22/israel-net-software-architects-user-group-meeting-july-2003.html)

- Jul 20, 2003

    ### [More active desktop](https://osherove.com/blog/2003/7/20/more-active-desktop.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
