I recently had to take a really deep look into how to cheat the CLR, that brought about some interesting discoveries, including the fact that it is, surprisingly, possible to do so.
Let us say that you have this code in some 3rd party assembly that you cannot modify:
internal interface IRunner
public sealed class AssemblyRunner : IRunner
public class CompositeRunner<T> where T : new()
public void Execute()
throw new InvalidOperationException("invalid type");
var runner = (IRunner)new T();
Can you get the CompositeRunner to output:
- before executing
- after executing
The real problem was a bit harder, but this is a good start.