Problem when profiling web application


I try to profiling a web application, this one use some external dll from external projects (ex.: Microsoft workflow and system.web.extensions.dll ) and from projects in the same solution.

So when i start my application everything is ok and when I try to profile it, it's begin well but there is an error :
System.InvalidProgramException: Common Language Runtime had detected an invalid program.


Stack Trace:


Sec.WebCatalog.Business.CollectionBase`1.FindFirstItem(String key, V value, PredicateKeyValue`3 pr) in L:\App\WebCatalog\Sec.WebCatalog.Business\CollectionBase.vb:47

BaseUserControl.OnPreRender(EventArgs e) in L:\App\WebCatalog\WebSite\App_Code\BaseUserControl.vb:376
System.Web.UI.Control.PreRenderRecursiveInternal() +140
System.Web.UI.Control.PreRenderRecursiveInternal() +219
System.Web.UI.Control.PreRenderRecursiveInternal() +219
System.Web.UI.Control.PreRenderRecursiveInternal() +219
System.Web.UI.Control.PreRenderRecursiveInternal() +219
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2775

The last line specified is well localize (in bold) but don't know how a "end function" statement can provoc an error when Visual Studio can compile it

And the line under is a non sense location, i try to rewrite it, drop it, the line change but the error is still present.

In the same time (don't know if it is linked), if i try to profile any thing directly in Visual Studio .Net 2005, I have this error:
Exception dispatching command: Object reference not set to an instance of an object

I work on Visual Studio .Net 2005, using framework .Net 2.0 with extensions for workflow. I have installed Framework .Net 3.0.



  • Hi,

    I wonder if you could try profiling in "Fast Mode" rather than "Detailed Mode" and see if you still get the error?

    (The difference being that in fast mode, we don't instrument your code, so it's a good way of narrowing down the problem.)

    Robert Chipperfield
    Red Gate
  • I understand only the professional one have this feature.

    I am more than happy to upgrade to this version but I will really feel bad if it doesn’t solve my pb.

    Is there any other way we can do this?
  • It's a little trickier since you're working with a web application, but if you delete the .PDB file, that should also do the trick. I think setting "Debug = false" in your web.config should do this.

    You'll also have to select "Profile all .NET methods" rather than just those with source code in order to actually get any results.

    Robert Chipperfield
    Red Gate
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Bertrand,

    I have an update to one of the ANTS Profiler components that I think may prevent this error. I am going to email it to you right now.
  • Ok, no code error but know I have a time out : HttpException (0x80004005)

    I do the trick "reregister IE (regsvr32 shdocvw.dll)" from here

    and it's work


    I tried, your fixed dll with my orignal configuration and it's work perfectly.

    Thx Brian for your help (speed and effectiveness :) )
  • For running ANTS, in 2005 and profilling a Class, a method, ... I still have the error :
    Exception dispatching command: Object reference not set to an instance of an object

    maybe I don't know how to use it ?
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Yes, this happens sometimes in the add-in. Can you go into the project's build properties, select the active configuration, and see if there is an 'output path' set? I think in some cases this is empty and you get this exception, although I'm unable to reproduce this because whenever I set this as empty in Visual Studio, the IDE sets it to build\debug automatically.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Ah. Never mind. You wouldn't have this option on a web project.

    But on the other hand, the profile namespace/class/method items should be grayed out.
  • ok, I try with a slolution with only a web application and a windows application and you right but I try to profile a class in the app_code folder of a webapplication and the error is thrown.

    Thx for the information, no problem with that because my application work now with the profiler directly so it's enough

    Just for information, to migrate from standard edition to the professional edition, what are the differences (possibility, price ) and how can we do ?
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Betrrand,

    ANTS Profiler Professional includes memory profiling, 'fast mode', and the API.

    Fast Mode allows you to see how your code would perform with optimization like inlining enabled, and the API allows snapshots to automatically be taken at precise points in your application. You actually include the calls to TakeSnapshot() in your own project; useful for profiling projects such as Windows Services. The price list is on our website:

    at the moment there is a $200 USD difference between Standard and Pro.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Bertrand,

    I think I see a potential problem in the add-in... can you confirm something for me? Is the solution composed of two or more individual projects and is the first project a desktop application? I think the add-in is only checking the project type of the first project in a set of project, leading it to expect a 'build folder' for the project. This property, of course, does not exist in web projects.
  • yes, I create a solution with a desktop application then i add a website in the solution. In this case the ANTS menu is available in class and method of the web site but the profiler wait for a desktop application ... but no error in this case.

    the error for me happen only when i try to profile class and method of file in the folder "App_code" or any sub-folder of a website application because the ANTS menu is enable.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Bertrand,

    I did not have any problems when I was in the app_code folder. I'm still looking, though.
Sign In or Register to comment.