Is the Visual Studio 2008 Javascript debugger crippled?

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Sadly, it appears the answer is “yes”. Specifically, the debugger has a huge limitation – one that’s been there since Visual Studio 2005 (maybe even 2003). You can’t set a breakpoint on the first line of an anonymous function. Consider, for example, the following: 1: 2: function aFunc() 3: { 4: alert(“hi”); 5: } 6:   7: var aFunc2 = function() 8: { 9: alert(“hi, yourself”); 10: alert(“what’s your problem?”); 11: } 12:   13: aFunc(); 14: aFunc2(); 15:  
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Here aFunc is a named function, and aFunc2 is a variable that points to an anonymous function. With the Visual Studio debugger, you can set a breakpoint on line 4, and line 10, but not line 9.
Why is this such a problem? Because most all the major Javascript libraries (at least Prototype, YUI, JQuery, and even, to a lesser extent, Microsoft’s own ASP.NET AJAX) use anonymous functions up the ying yang – mostly for object methods. In other words, you can’t set a breakpoint on the first line of most functions in most AJAX libraries. And if the function has only one line, yeah, you’re screwed – no break-ey break-ey for you.
When I learned that this bug wasn’t fixed in Visual Studio 2008 I was, in a word, dumbfounded. Isn’t improved Javascript development one of the primary new features of VS2008?
Now, when I characterized the problem as being related to anonymous functions, that isn’t quite right. In the above code, even if you give the aFunc2 function a name – “var aFunct2 = function theFunc()…”- the problem remains. There’s a brief discussion of this issue on the ASP.NET forums here (note the date – March 2007), but the explanation rather nebulous. Whatever the root cause, it’s a horrible limitation that I’m stunned wasn’t addressed for RTM.
Guess it’s back to Firebug for me. Or maybe it’s time for another look at Aptana.

X ITM Cloud News

Ana

Next Post

Programmers and typists

Mon Nov 25 , 2019
Spread the love          The inimitable Jeff Atwood of Coding Horror fame (or is it Stack Overflow fame now?) recently blogged about the importance of typing skills for developers. In typical smackdown style, he posited that “coding is just typing”. Jimmy Bogard disagreed, saying that the number of lines of code typed […]
X- ITM

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware

.

X ITM