Silverlight, WPF and .NET Subscribe via RSS
Photo of Alan Cobb
About me:   I'm a Silverlight 4, WPF (Windows Presentation Foundation) and .NET programmer based in Northern California, USA.   See more about the Silverlight presentations I have been giving here.

I'm currently available for work.  Send me an email at the address here and we can talk about your project. 
A more debuggable Silverlight.js :
By: Alan Cobb Date: 2007-Oct-20 19:40

The main point of this article is to make my reformatted, more debuggable version of Silverlight available to other people for download:

      For 2007-09 v1.0 SDK:  Silverlight_DebugPretty_V10.js 
      For 2007-09 v1.1 SDK:  Silverlight_DebugPretty_V11.js

Background and explanation:
As you probably know, Silverlight.js is a helper file that all Silverlight applications are required to use when starting up.  To make it download faster it has been "minified" into a single line of JavaScript 7000+ characters long.  That's OK for production use, but it makes the source code unusable for debugging.  For debugging you want to be able to use Visual Studio to single step through readable, understandable source code and look at variable values and stack traces.

The 2007-07 version of the Silverlight SDK included such a reformatted Silverlight.js (even including some descriptive comments [gasp!]), but I couldn't find one in the 2007-09 versions of the SDK.  So I made the ones linked to above. 

To do the reformatting ("pretty printing") I started with a free trial copy of the commercial Polystyle code-reformatter product.  That turned the single JavaScript line into about 400 readable lines, with proper indenting.  I followed that with a little hand editing to visually separate the individual methods with lines of asterisks.  One could go even further and add some descriptive comments.

Once you are a old hand at JavaScript and Silverlight you probably won't spend much time looking at Silverlight.js.  But if you are like me, with a background in C# and C++ you may initially find JavaScript's behavior somewhat "odd" and mysterious.  It can be instructive to single step through the startup code in Silverlight.js.  See how one of the first steps is to "instantiate" all the methods of the Silverlight object so they can be called later?

Minification and obfuscation:
I found out via petemounce on the Silverlight Forum (see: that there are tools available specifically for the task of minimizing the size of ("minifying") your JavaScript or HTML.  See:

This is closely related to the task of obfuscation, in which you try to make your code harder to reverse engineer.  Deliberately debugger-unfriendly.  See:

Comments [5]  |  Silverlight | debugging #  
First entry for Alan Cobb's new blog (Done 2007-10-03)
By: Alan Cobb Date: 2007-Oct-03 11:56


This is my new blog.  Interesting Silverlight, WPF and .NET technical content to follow...

Regarding how this blog was designed and implemented:
My visual design priorities for this site's HTML/CSS were a liquid layout and good tolerance of text resizing.  Similar to

As the footer shows, this blog is currently implemented with dasBlog 2.x running on ASP.NET 2.0.  I'm currently hosted on GoDaddy and happy with them.  To get the visual look and liquid resizing behavior I wanted, I needed to modify some of dasBlog's ASP.NET C# code as well as the page templates and CSS.

Alan Cobb

Comments [1]  |  dasBlog #  
Copyright 2015 Alan Cobb:    Subscribe: Subscribe via RSS
Theme by Alan Cobb, based on dasBlog calmBlue.
newtelligence dasBlog 2.3.9074.18820
Page rendered: 2015-Jan-30 21:25 CA, USA Time
dasBlog logo
Admin Login