Clone wiki

CodeCop / Home


CodeCop is a library that builds on top of JSON to provide a fast unobtrusive way to write method interceptors for your .NET apps.

Configuration is independent from your app's code. It's done via a JSON file which means that at anytime you can add or remove interceptors without code changes or redeploys. This file can be manually or automatically generated.

Methods can be intercepted in one or all of these stages, before execution, after execution and it is possible also to override the behaviour completely.

CodeCop uses no proxies or wrapper classes, instead it works with the original objects in-memory, making method interception quick to achieve.

With CodeCop you can intercept 3rd-party .NET libraries as well, so it has never been easier to create instrumentation scenarios where one needs to know why it is taking so long for a certain method to execute.

It's also very suitable for mocking/faking test scenarios as all intercepted methods can be overrided in their original behaviour.

If your not a JSON lover and you prefer more of a coding approach, don't worry we've got you covered! CodeCop also provides a full-blown Fluent API for you to use and abuse.

From v2.0 onwards we also have a Process Injection API that will let you inject CodeCop and interceptors into any .NET process and perform method interception on it.

Last but not least v3.1 introduces the Type Creation API that will let you create types at runtime without using dynamic compilation.


  • Unobtrusive, configured via JSON
  • Works entirely in-memory
  • No post-build assembly rewrites
  • No plugin or add-on installations
  • New interceptors can be added without recompilations
  • No code pollution with attributes or MarshalByRefObject
  • Constructor Interception and Override
  • Method Interception and Override
  • 3rd-Party Method Interception and Override (defined in a different assembly)
  • Property Interception and Override
  • Generics Compatible
  • Async Compatible
  • Boilerplate code reduction

Quick Start

Our Getting Started tutorial walks you through integrating CodeCop with a simple application and gives you some starting tips for learning more.

API Documentation

For a more complete understanding of CodeCop use our API Documentation page.


We have made it very simple for you to license your CodeCop product, just follow the instructions on our Licensing page.

Use Cases

Check out our Use Cases page to get you warmed up on that you can do with CodeCop.

FAQs Section

Read the FAQs section for the most prominent questions about CodeCop.


Ready to deploy your app with CodeCop? Make sure you read the deploy section.

.NET Framework Versions

CodeCop was built for .NET 4.0 and upper versions.

For CodeCop versions lower than 2.1.1 if you have .NET 4.6 installed and are building a x64 app make sure you disable RyuJIT by adding a useLegacyJit DWORD with a value of 1 and also changing the existing UseRyuJIT DWORD value to 0 under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework registry key.


As you can imagine writing something like this is far than simple, so expect issues to happen and please do report them on our Issues Page so that we can make this a better product everyday.

Product Comparison Board

For a quick overview of all products and features check out this board.

Nuget Packages

You can get CodeCop by grabbing the latest NuGet package

YouTube Channel

Check our channel for instructional videos.