Monday, March 16, 2015

JIT Compiler Encountered an Internal Limitation

JIT Compiler Encountered an Internal Limitation

Problem:

When collecting IntelliTrace data or Debugging an ASP.NET Web Application with Visual Studio 2013 you receive the Yellow Screen of Death in the browser that says...
 JIT Compiler encountered an internal limitation.
   at Telerik.Web.SkinRegistrar.GetRuntimeSkin(ISkinnableControl control)
   at Telerik.Web.SkinRegistrar.GetEmbeddedSkinAttributes(ISkinnableControl control, Type controlType, Boolean designTime)
   at Telerik.Web.SkinRegistrar.GetEmbeddedSkinAttributes(ISkinnableControl control, Type controlType)
   at Telerik.Web.SkinRegistrar.RegisterCssReferences(ISkinnableControl control)
   at Telerik.Web.UI.RadAjaxLoadingPanel.RegisterCssReferences()
   at Telerik.Web.UI.RadAjaxLoadingPanel.ControlPreRender()
   at Telerik.Web.UI.RadAjaxLoadingPanel.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Solution:

In the connect bug related to this issue, you'll see the advice to turn off IntelliTrace or to run your project without debugging. While these two workarounds are effective in getting your site running, they leave a lot to be desired when it comes to being able to get the debug info you may need to solve . In the case above, the compiler is choking on the Telerik assemblies that are part of this web application. In order to keep IntelliTrace and Debugging working, you need to do two things depending on your situation...

Visual Studio Debugging:

1) Open Visual Studio
2) Select Tools --> Options...
3) On the left side of the Options dialog, Select IntelliTrace --> Modules
4) Click Add...
5) Type PublicKeyToken:121FAE78165BA3D4
6) Click Add to dismiss the Add a Pattern dialog
7) Click OK to dismiss the Options dialog


IntelliTrace Stand-alone Collector:

1) Open the Collection Plan XML file you are using for your trace. (i.e. collection_plan.ASP.NET.trace.xml)
2) Add a child element to the <ModuleList isExclusionList="true"> element, this child element should be: <Name>PublicKeyToken:121FAE78165BA3D4</Name>

I hope this can prevent someone else from wasting time trying to track this down. If your error is not related to the Telerik assemblies, you can always change the Public Key Token to that of the assembly which is causing trouble in your particular case.