Cause code to be pre-JITted at run time without using PrepareMethod
===

I need to cause some code in my application to be pre-JITted. The scenario is an XNA game running under Windows Phone. When an explosion first happens, there is a noticeable pause while the methods that implement the explosion physical modelling are JITted. I know this because this issue happens on the Windows build as well, and disappears when the assemblies are NGEN'd. I have also used the method of JITting at runtime which is mentioned in a few answers here and [originates on CodeProject][1] (using reflection and [`PrepareMethod`][2]) .

However, I can't use NGEN, because it's a Windows Phone app. I also can't use the other method `PrepareMethod` is marked as `SecurityCritical`, and you can't call that on Windows Phone.

I don't mind the fact that it may take some time, because the initialisation would happen on a separate thread while a loading screen is displayed.

Are there any elegant methods to achieve a similar result and, failing that, any methods at all?


  [1]: http://www.codeproject.com/Articles/31316/Pre-compile-pre-JIT-your-assembly-on-the-fly-or-tr
  [2]: http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.runtimehelpers.preparemethod.aspx