Problems with ASP.NET profiling

Up to Bugs & Problems

Problems with ASP.NET profiling

Posted by Matteo Tontini at August 29. 2008
Hello,
I read other posts about profiling asp.net and it appears to be possible.
I followed the instruction by addinga a new page in my web application (the page is named Profile.aspx).
This page with its codebehind is included in my web application project.
The page contains only a button with its own click event handler:

protected void Button1_Click(object sender, EventArgs e)
{
Runtime.TakeProfileSnapshot();
}

I added a reference to the EQATECProfilerRuntime.dll in the Eqatec profiler install path.
I built my solution.
I generated the profiling assemblies (the directory bin(Profiled) )
I swapped the original bin directory with the profiled one.

I ran my application with asp.net and then browsed to the Profile.aspx page.
Clicked on the button and got this exception:

EQATEC.Profiler.RuntimeException: EQATEC Profiler error: TakeProfileSnapshot failed

and the following exception stack:

[RuntimeException: EQATEC Profiler error: TakeProfileSnapshot failed]
EQATEC.Profiler.Runtime.TakeProfileSnapshot(String filename, Boolean clear) +1799
EQATEC.Profiler.Runtime.TakeProfileSnapshot(Boolean clear) +97
Profile.Button1_Click(Object sender, EventArgs e) +60
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746



I would like to use your tool to profile my web application but I cannot make it work.
Could you tell me what the problem is?

Thank you very much

Matteo

Re: Problems with ASP.NET profiling

Posted by Matteo Tontini at August 29. 2008
I'm sorry,

the problem was, as you said answering to another post, that aspnet user needed write permission to disk C:

Thank you very much for the useful tool

Matteo

Re: Problems with ASP.NET profiling

Posted by Richard Flamsholt at August 29. 2008
Hi Matteo,

I'm really glad you found the problem, and apologize for the sparse exception message. It's a bit strange, though, because it should have been more elaborate. The exception handling for that part goes like this:

catch (Exception ex)
{
try
{
throw new RuntimeException("TakeProfileSnapshot failed: {0}", ex.Message);
}
catch
{
throw new RuntimeException("TakeProfileSnapshot failed");
}
}

-so the message you saw should only appear when there's an exception fetching ex.Message. I've seen it fail before, but only on .NET CF. Peculiar. Seems we'd better improve on the error-message handling :)

cheers, Richard

Re: Problems with ASP.NET profiling

Posted by Anonymous at September 10. 2008
Hello Richard,

sorry but in my opinion you're always catching the verbose exception ("TakeProfileSnapshot failed: {0}", ex.Message) and then throwing the simple one ("TakeProfileSnapshot failed").
My colleague Davide suggests to implement it like this:

catch (Exception ex)
{
string message = null;
try
{
message = ex.Message;
}
catch
{
throw new RuntimeException("TakeProfileSnapshot failed");
}
throw new RuntimeException("TakeProfileSnapshot failed: {0}", message);
}

Re: Problems with ASP.NET profiling

Posted by Richard Flamsholt at September 11. 2008
Hi,

You're absolutely right! I honestly don't know what we were thinking when the original single throw was moved into a try-catch block - the fine elaborate exception will of cause always be caught by the catch. D'oh!

So, thanks for the comment - it'll make it into a bugfix soon.

best regards,
Richard


Powered by Ploneboard
http://www.eqatec.com / Forum / EQATEC Profiler / Bugs & Problems / Problems with ASP.NET profiling