Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do script blocks grow endlessly in VS2010 Debugger when running ASP.Net page with partial postbacks?

Tags:

On an ASP.Net page that uses an UpdatePanel containing various validated controls for partial postbacks, the Visual Studio 2010 script debugger window starts to show an ever growing list of "Script Block" entries which appear to be anonymous our auto-generated functions related to the controls on the panel as it is reloaded. It appears that old script blocks from previous times the panel was updated are not disposed so the list just keeps on growing, slowing down the page and the debugger, until IE is closed whereupon it can take a long time to delete the hundreds of blocks that have appeared.

Is this a problem with the way the page is operating or an artifact of the debugger? Comparing performance of the debugged and non-debugged page it appears to be the latter, but it would be good to know what is going on and why.

like image 461
glenatron Avatar asked Aug 18 '11 14:08

glenatron


1 Answers

Well Well here is your answer.

First Way

http://vishaljoshi.blogspot.com/2009/06/disabling-script-debugging-with-vs-2010.html

Basically when you debug through VS2008/2010, IE8 and forward, script debugging will be enabled automatically. Which is criticized by many. However there are few workarounds.

First one is in above article which tells you to enable Silverlight debugging and tells you path for both Projects as well Websites, where to go and how to enable it.

Once you enable silverlight debugging JS debugging is turned off as both can't run side by side.

Drawback (if you really think it is ): Silverlight tools for VS need to installed

Second Way

Start the application without debugging (CTRL + F5) once app running attach debugger manually by clicking on Debug->Attach to Process.

Now for VS 2008

For VS 2008 there are several alternatives like editing registry keys and so forth.

If anyone need VS 2008 help regarding that check this out. http://blogs.msdn.com/b/greggm/archive/2009/04/06/disabling-script-debugging-in-vs-2008-ie8.aspx

like image 173
Adnan Bhatti Avatar answered Sep 23 '22 02:09

Adnan Bhatti