Friday, January 18, 2008

.NET Framework Library Source Code now available

I was really excited last October when I hear that Microsoft was going to release the source code to .Net.  After the launch of .Net, I was excited to get a hold of the source code but then read the article, VS2008/.NET 3.5 Ships...sooooo...where's the source? where Shawn Burke mentioned that they didn't want to turn it on over a holiday weekend and that they had found a performance issue that required a hotfix so it was going to be a couple of weeks before .net developers would be able to start stepping through the .Net reference source code.   

I hadn't hear anything about it in a while, so a couple of days ago I was trying to "google" any news about the release of the source code but didn't find anything. 

Today, Scott Gu announced that the source code to the following libraries is now available:

  • .NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, etc).
  • ASP.NET (System.Web, System.Web.Extensions)
  • Windows Forms (System.Windows.Forms)
  • Windows Presentation Foundation (System.Windows)
  • ADO.NET and XML (System.Data and System.Xml)

Some of the libraries that are not yet included are LINQ, WCF and Workflow, which I am a little surprised because though are some of the most recent libraries.

I am a little confused about what the source code contains because in previous posts by Microsoft bloggers it was mentioned that the source code release only covers framework 3.5 and not 2.0/3.0 and only applies to Visual Studio 2008 (not VS 2005) for debugging, although there is going to be a downloadable copy as mentioned previously and in various posts

Its been joked about that Shawn Burke is trying to put Lutz Roder about of a job - funny because Lutz works for Microsoft.  I'm sure Lutz Roeder will do fine even after the source code release.  Reflector is still one of the easiest and fastest ways to search and navigate though code (I love the hyperlinks), even your own code!!!

Monday, January 7, 2008

Links of Week, Jan 7: ASP.NET MVC, Live Writer, VS 2008 AJAX 1.0, Music Lessons, GUI Testing

Link of the week - ASP.NET MVC

How will MS MVC affect the greater developer community: Dan Donahue, a member of the community, wonders with the ASP.NET MVC, Ruby On Rails and MonoRail getting a lot of attention recently if Microsoft will make ASP.NET MVC the mainstream way of web development (or the "One Microsoft Way").  He wonders about the affect it would have for easy interoperability (between rails web platforms) and test driven development.




  • Automated GUI testing - Is it worth it? Based on his experience with NUnitForms, Mladen Prajdić concludes that if used wisely automated GUI tests are a big benefit for Integration and Acceptance Tests.
  • Music lessons: Seth Goden discusses some marketing lesson that can be learned from music such as rule 0. "The new thing is never as good as the old thing, at least right now." and "Celebrity is underrated".

Monday, November 19, 2007

Visual Studio 2008 and .NET Framework 3.5 shipped!

Soma Somasegar announced earlier this morning that Visual Studio 2008 and .NET Framework 3.5 shipped!.  Visual Studio is now available for download from the MSDN subscription site.  It is also available for download as a 90-day free trial edition of Visual Studio 2008 Team Suite.  The 90-day trial edition of Visual Studio 2008 Professional is not available yet but will be available next week.  You can also download the free Visual Studio 2008 Express edition.

.NET Framework 3.5

The .NET Framework 3.5 is more of an incremental improvement than the sweeping change that .NET 2.0 was.  At least as far as the framework and runtime are concerned.  The main theme of .NET 3.5 was to avoid breaking changes.  In fact they marked the base code with "red and green bits" to indicate what they were allowed to change.  

VS 2008 Multi-Targeting Support

While there is not a new runtime in .NET 3.5 framework, it does have the new C# 3.0 and Visual Basic 9.0 compilers.  Because there is not a new runtime in 3.0 and 3.5, VS studio is now able to target the .NET 2.0, 3.0, and 3.5 frameworks. 

VS 2008 Web Designer and CSS Support

VS 2008 now includes the same web designer as Expression Web.  This new designer now includes a "split view editing" mode that shows both the HTML source code and "WYSIWYG" designer mode at the same time.  The new designer is the feature that I have been looking forward the most.  The designer not perfect but it is much better than the previous designer.  It includes a CSS style manager that shows all of the stylesheets you currently editing.  The CSS properties window is much like Firefox's Firebug except in the IDE instead of the browser.  It would be nice if the Internet Explorer team would update the Developer Toolbar to have the same features such as a better display of why a css class is getting overwritten (I don't find the applied styles feature nearly as useful Firebug).

Language Improvements and LINQ

VS 2008 provides some great syntactic sugar over the previous C# version.  In fact because there is not a new runtime technically all of the new language features are syntactic sugar including the LINQ syntax.  However the new language features are very powerful, expressive, and are probably the biggest change out of all the changes that were made.

Here are some of the new language features that Scott Gu has blogged about:

  • Automatic Properties: provides a default implement of get and set
  • Object Initializers: almost like having methods with named parameters
  • Collection Initilizers: save keystrokes by avoiding multiple Add statements
  • Extension Methods: add new methods to any class without inheritance
  • Lambda Expressions: very compact, functional programming syntax 
  • Anonymous Types: introduces the strongly typed "var" keyword (think JavaScript)

Congratulations to the Microsoft Visual Studio team on a job well done!!!  I guess I'll get to congratulate you again when it officially launches in February.

Saturday, October 20, 2007

FckEditor inside UpdatePanel broken

FckEditor (or Fck) is a lightweight, JavaScript based WYSIWYG html editor for web applications.  I find it one of the best html editors out there along with FreeTextBox (or FTB), a popular ASP.NET-centric html editor.  The best thing about both of the editors is that they are free.  The advantage of Fck it that is works with a couple of different web platforms including Java, PHP, and .NET.  However, one thing I have found lacking is the FckEditor's documentation

HTML Editor solutions usually rely on an iframe or div to be the actual html editor so they require a second hidden input field to be the input field that will post the value of the editor back to the server.  This is normally not a problem because they usually update the input field before the form is posted.  However the Microsoft AJAX UpdatePanel does not do normal form posts, so html editors like Fck and FTB don't get a chance to update their linked field.  I have yet to see an official fix from the developers of both these solutions.  Many people have asked "which editors work with UpdatePanel?", including the html editors that are not free including Telerik's RadEditor and Infragistics' NetAdvantage WebHtmlEditor.

I found two different solutions for fixing the FckEditor UpdatePanel updating problem.  The first solution handles the onclick event that triggers the async postback and then use a client-side JavaScript function to update the hidden linked input field.  The second solution I found was better because it attached to the OnSubmit event which works with both synchronous and asynchronous postback calls.  The second solution also updated all of the editors on the page instead of a specific one - the reason why I was looking for another solution in the first place.

Here is the C# code for the second solution (for the Page_Load event):

    "for ( var i = 0; i < parent.frames.length; ++i ) if ( parent.frames[i].FCK ) parent.frames[i].FCK.UpdateLinkedField();"


Friday, October 12, 2007

.NET Framework Source Code to be Released

There is great news on the .Net front as Scott Guthrie announced that the source code .Net 3.5 is going to release under Microsoft Reference License (MS-RL).  However this is not full open source license like Microsoft Permissive License (Ms-PL), which will soon be renamed the Microsoft Open License.  Ms-PL allows derivative works unlike Ms-RL where you can't copy the code.  So Mono developers are encouraged to not look at the reference code and keep on reverse engineering .Net.  I do assume that because it is a reference license, you can make references to the source code (on say a blog), although I am not an expert on copyright law.

Shawn Burke is one of the people that drove the initiative to deliver the source code, in fact on his blog in 2005 he said "I want to deliver Windows Forms source code to you".  In fact, Shawn Burke talks about the history of this release in a podcast "Interview with Shawn Burke on Microsoft's .Net Source Code Release".  Please note that this is not Rotor (an open source, reference implementation of .Net).  This is also not Mono, the Novell led reverse engineered version of .Net.  This is also not code de-complied from Lutz Roeder's .Net  Relector.  Many developers have been "peeking under the hood" of .Net for quite a will now using Reflector, but this does not show the original source code just the source code "intent" as it is complied.  Java has had its source code for available for as long as I can remember.  Having the Java source code helped me become an expert quicker than developers that didn't read the source code.

One of the best parts is we are going to be able to step through the .Net source code using VS 2008 because Microsoft is also going to be providing the debug symbols as well.  The debug symbols, which is what links the source to each .Net DLL, are provided by a Microsoft symbol server which has been helping developers debug code for years.  I had looked into getting previous versions of .Net to be able to step through the code, but it required recompiling using ildasm and that didn't sound very desirable.

Congratulations to Shawn Burke, Scott Gu for providing us this valuable information!!!  This will help developers know more about the platform they are developing on as well as build higher quality code.

Monday, October 1, 2007

Error: The name '___' does not exist in the current context

Recently I got the following error "The name '___' does not exist in the current context" where '___' was the member variable of one of my controls.  I was really confused because even though it was a recently add control I was sure that I was doing it right.  So what else could be the problem?  Well it turns out that I had made a backup copy of the file in the same directory before I had changed it.  I turns out that in a Asp.Net 2.0 website you can't have two ASP.NET pages or user controls with the same name class name.  Because the pages are partial classes it does not give the error "The namespace '<global namespace>' already contains a definition for '_____'" like you would normally get if you redefined a class.  However it seemed that it only use one of the markup files to build the markup's partial class (or it could be that the second backup markup file overwrote the class for the first markup file).  Because it was using the markup partial class from the backup file and the new variable did not exist in that file I got the undefined variable error.  Also unlike ASP.NET 1.1 and 2.0 Web Application projects you can't have two classes with the same CodeFile.  Although it is not an error in a dynamically complied ASP.NET 2.0 website it is an HttpCompileException error in a precompiled ASP.NET website.  The ASP.NET 1.1 Installation Project also had problems with what it considered duplicate files where the main website's project would compile fine but when generating a msi installation package it would complain about the duplicate files.

AJAX Control Toolkit 10920 Released

On September 21, a new version of the AJAX Control toolkit was released.  The title of Delay's Blog's blog entry on it was "You voted lots, we fixed lots [AJAX Control Toolkit release!].  I thought the title was great because it shows a desire to add value to their customers and fulfill their wants/needs. 

Some of the biggest improvements in this release focus around the Calendar calendar extender.  In the previous version, I used the "textbox" activation for the calendar which means that instead of clicking a button to open the calendar you clicked on the textbox that had the current value.  I wanted to use the button activation using the extender's PopupButtonID property, but there was a problem that after you opened the calendar using the pop up button you had to select a date to close the pop up.  I would have expected that just clicking off would have closed the calendar.  In the new version you can now "click  off" to close.

In the blog "inventive title", Ron Buckton tells some of the changes and difficulty implementing them regarding the calendar.

The next version of Calendar needs to support the following activation scenarios depending on whether it is also associated with a button:

  • No Button
    • Show Popup when textbox receives focus
    • Show Popup when textbox is clicked
    • Hide Popup when textbox loses focus
    • Hide Popup when textbox receives ESC keypress
    • Hide Popup when a date is selected
  • Button
    • Show Popup when the button is clicked
    • Hide Popup when the button loses focus
    • Hide Popup when the button receives ESC keypress
    • Hide Popup when a date is selected

I have to that the control toolkit team for improving the activation of the calendar! Now I can use the popup button with my calendar.  Now if only there was a built in WSYSIWG editor.