Error profiling ASP.NET app when an AJAX control is present

Code profiling for .NET Developers

Error profiling ASP.NET app when an AJAX control is present

Postby bbirney » Mon Feb 08, 2010 8:45 pm

Hi there. When trying to profile my ASP.NET application, the profiler normally works as expected. However, whenever it encounters a page that uses an AJAX control (in this case, the 'official' ASP.NET AJAX \"CascadingDropDown\" control), the app crashes, at the location noted below. This page does work as expected when run outside of the profiler.

Code: Select all
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Bad unmanaged code entry point.

Source Error:

Line 4:          <asp:Label ID=\"Label7\" AssociatedControlID=\"MajorCommodity\" Text=\"Major Commodity\" runat=\"server\" /> <% if (!DisplayVertically) { %><br /> <% } %>
Line 5:          <asp:DropDownList ID=\"MajorCommodity\" width=\"175\" runat=\"server\"/>
Line 6:          <ajaxToolkit:CascadingDropDown ID=\"MajorCommodityTypeCascadingDropDown\"
Line 7:              runat=\"server\"
Line 8:              TargetControlID=\"MajorCommodity\"

Source File: c:\\This.Isnt.Really.The.App\\Controls\\CommodityTypeSelector.ascx    Line: 6

Stack Trace:

[TypeLoadException: Bad unmanaged code entry point.]
   AjaxControlToolkit.CascadingDropDown..ctor() in C:\\Users\\swalther\\Projects\\AspNetAjax\\Releases\\30930\\AjaxControlToolkitSource\\AjaxControlToolkit\\CascadingDropDown\\CascadingDropDownExtender.cs:41
   ASP.controls_commoditytypeselector_ascx.__BuildControlMajorCommodityTypeCascadingDropDown() in c:\\This.Isnt.Really.The.App\\Controls\\CommodityTypeSelector.ascx:6
   ASP.controls_commoditytypeselector_ascx.__BuildControlTree(controls_commoditytypeselector_ascx __ctrl) in c:\\This.Isnt.Really.The.App\\Controls\\CommodityTypeSelector.ascx:1
   ASP.controls_commoditytypeselector_ascx.FrameworkInitialize() in c:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\Temporary ASP.NET Files\\root\\5883765a\\95915a02\\App_Web_3gsz6yrq.7.cs:0
   ASP.packages_aspx.__BuildControlCommodityTypeFilterSelector() in c:\\This.Isnt.Really.The.App\\Packages.aspx:7
   ASP.packages_aspx.__BuildControlPanel1() in c:\\This.Isnt.Really.The.App\\Packages.aspx:6
   ASP.packages_aspx.__BuildControlContent2(Control __ctrl) in c:\\This.Isnt.Really.The.App\\Packages.aspx:5
   ASP.masterpages_NotTheRealName_master.__BuildControlFiltersContent() in c:\\This.Isnt.Really.The.App\\MasterPages\\NotTheRealName.Master:77
   ASP.masterpages_NotTheRealName_master.__BuildControl__control14() in c:\\This.Isnt.Really.The.App\\MasterPages\\NotTheRealName.Master:76
   ASP.masterpages_NotTheRealName_master.__BuildControl__control9() in c:\\This.Isnt.Really.The.App\\MasterPages\\NotTheRealName.Master:25
   ASP.masterpages_NotTheRealName_master.__BuildControlMainForm() in c:\\This.Isnt.Really.The.App\\MasterPages\\NotTheRealName.Master:24
   ASP.masterpages_NotTheRealName_master.__BuildControlPageBody() in c:\\This.Isnt.Really.The.App\\MasterPages\\NotTheRealName.Master:22
   ASP.masterpages_NotTheRealName_master.__BuildControlTree(masterpages_NotTheRealName_master __ctrl) in c:\\This.Isnt.Really.The.App\\MasterPages\\NotTheRealName.Master:1
   ASP.masterpages_NotTheRealName_master.FrameworkInitialize() in c:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\Temporary ASP.NET Files\\root\\5883765a\\95915a02\\App_Web_p6javn8g.0.cs:0
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +1236
   System.Web.UI.Page.get_Master() +141
   System.Web.UI.Page.ApplyMasterPage() +60
   System.Web.UI.Page.PerformPreInit() +109
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1452


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
Posts: 8
Joined: Mon Feb 08, 2010 6:44 pm

Please assist in resolving this issue

Postby bbirney » Tue Feb 09, 2010 1:57 pm

Please assist in resolving this issue. We are currently evaluating ANTS. I would like to recommend to my manager that we purchase it, but I can't do that unless we can make it work.

Even a push in the right direction would help.


Ben Birney
Posts: 8
Joined: Mon Feb 08, 2010 6:44 pm

Postby AndrewH » Wed Feb 10, 2010 11:57 am

I'm looking into this today. I don't have a reproduction yet so I can't be specific.

However, this particular error is usually caused by a problem with the instrumentation added by the profiler. We had previously only seen this occur when an instrumented assembly was further modified by reflection, though we've seen a lot more reports of this in other situations recently (I'm not sure why, though I suspect that what's changed is that more people are using 64-bit systems, which has different JIT error checking behaviour to 32-bit systems)

It's likely that turning off line-level timings will stop the error occurring. I think this issue is more common on 64-bit systems, so an alternative approach might be to try reconfiguring the application to run in a 32-bit application pool.
Andrew Hunter
Software Developer
Red Gate Software Ltd.
Posts: 118
Joined: Thu Aug 17, 2006 2:44 pm

Postby AndrewH » Wed Feb 10, 2010 6:05 pm

Hmm, I'm not able to reproduce this problem: by itself the AjaxControlToolkit dll seems fine. What other third-party components are you using with your website?

It's also possible this is a trust issue: to do line-level timings, the profiler requires that an assembly be loaded with full trust. The AjaxControlToolkit DLL comes in a zip file that marks it as a file from the internet zone, which usually causes .NET to reduce the trust level.

Could you try the following command from a command prompt in a folder containing the dll:

Code: Select all
  more < AjaxControlToolkit.dll:Zone.Identifier

If you see something like this, then it's likely that the DLL is untrusted:

Code: Select all
C:\\Inetpub\\wwwroot\\AJAX2\\Bin>more < AjaxControlToolkit.dll:Zone.Identifier
Andrew Hunter
Software Developer
Red Gate Software Ltd.
Posts: 118
Joined: Thu Aug 17, 2006 2:44 pm

Return to ANTS Performance Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests