Microsoft is releasing the source to the .NET Base Class Libraries as well as the top three presentation technologies in the framework, ASP.NET, Windows Forms and WPF.
There were many times I was writing a bit of sample code and I needed to do something specific. I’d then realize, “oh the DateTimePicker does that” and I would crib the corresponding source from the framework code. The second sample mentioned above is a great example. In the .NET Framework 2.0 we added a multiline editor to the TextBox’s Text property in the property grid. A few customers asked how to add this to their controls and I grabbed the corresponding code from this from the framework and built a sample control around it.
The other big advantage of having the framework source code is debugging. No more dreaded “[External Code]” in call stacks and you’ll never have to look at disassembly because the source isn’t available. If you hit an exception you don’t understand, you can now step into the framework code that threw and see what it’s expecting to make everything work. This will save many trips to forums and newsgroups.
I realize that tools like Lutz Roeder’s excellent Reflector can help users understand the code in the framework, but there’s nothing as useful as diving into the framework code while it’s running in the debugger.
Hopefully the source code for the Silverlight framework will be released as well. Scott’s blog post has more information, screenshots and videos.