.NET 3.5 Enhancements Training Kit

The Visual Studio & .NET Framework Evangelism team did it again. After their cool .NET 3.5 Training Kit they are now working on the follow up: the .NET 3.5 Enhancements Training Kit. It’s not final yet, but still very interesting!

Currently, the training kit contains six hands-on labs, made up of the following technologies:

  1. ADO.NET Data Services
  2. ADO.NET Entity Framework
  3. ASP.NET AJAX History
  4. ASP.NET Dynamic Data
  5. ASP.NET MVC
  6. ASP.NET Silverlight controls

Read more about it on Jonathan Carter’s blog.

Beware of the SharePoint Memory Leaks!

Beware of the SharePoint Memory Leaks!

You might not know it, but when developing for SharePoint (either WSS 3.0 or MOSS 2007) it is very easy to cause memory leaks, which can ultimately thrash your SharePoint server’s performance. The reason for this is that even though your own code might be written using only managed code, the SharePoint API still uses unmanaged code in some places. These unmanaged resources have to be explicitly disposed of, especially considering the fact they are living inside an ASP.Net web application (SharePoint) and potentially can have a long lifetime.

The problem is that the SharePoint API doesn’t always make clear when exactly you have to dispose of objects explicitly. Sometimes it may look like you’re just inspecting a value of a property, while in the background a whole new object is instantiated, which holds valuable unmanaged resources that should be freed by the caller (you!). Other times you might find yourself disposing an object, only to find out you weren’t supposed to…

Way back in June 2006 Microsoft employees Scott Harris and Mike Ammerlaan released their article Best Practices: Using Disposable Windows SharePoint Services Objects on MSDN, which can be regarded as the mother of all articles on this subject. I think this article is often overlooked and should be considered essential reading material for every serious SharePoint developer out there. Also read their more recent article called Best Practices: Common Coding Issues When Using the SharePoint Object Model, which also handles topics like data and object caching and writing scalable code.

Recently two other Microsoft employees also wrote interesting pieces on this subject. Stefan Goßner did a piece called Dealing with Memory Pressure problems in MOSS/WSS, in which he explains what a "Memory Pressure Situation" is and he lists some common causes and solutions for it. The other interesting read came from Roger Lamb. His entry is called SharePoint 2007 and WSS 3.0 Dispose Patterns by Example and in it he shows some very clear code samples and patterns on how to properly handle SharePoint objects.

Very cool material, guys!

Return of SmartPart V1.3 released

Yesterday Jan Tielens released a new version of his famous SmartPart to the community. It is now at version 1.3 and here’s the changelog:

  • Added a setup wizard to install the Return of SmartPart.
  • Added sample user controls (including connectable user controls and AJAX user controls).
  • Added localization support for ASP.NET AJAX user controls.
  • Various minor bug fixes.
  • Nice 2-minute screencast on how to deploy and test the SmartPart.
  • 64 bit version available.

Great work, Jan! I also like the fact you’ve used Lars Fastrup‘s SharePoint Solution Installer for deploying SmartPart.

Vista SP1 setup language pack error

Right after I finished my previous blog post I started to install Vista SP1 myself. Unfortunately right after executing the installer I got a nice little messagebox, saying Vista Service Pack 1 setup couldn’t continue, because my version of Vista was unsupported. Now I run the English language version of Vista Ultimate (32 bit), so at first I couldn’t figure out why I got this error.

Then I looked at the error message more closely (unfortunately I cannot remember the exact words anymore) and noticed it said something about unsupported language packs being installed on the system (Vista SP1 is currently only available for the English, French, German, Japanese and Spanish language versions of Vista). I did remember seeing several language pack updates appear during a Windows Update session way back when I first installed Vista on this machine. However I couldn’t remember installing any of them.

To be sure I checked the Vista installed Programs and Features list for any installed language packs, but couldn’t find any. Using Google I found this article about Vista Language Packs and at the bottom of this article there were some instructions on how to remove a Vista language pack. It turned out installed Vista language packs aren’t listed in the Programs and Features list, but at a different location.

To cut a long story short, it turned out I had once installed the Dutch Vista language pack and had forgotten all about it. Unfortunately the mere presence of this Dutch language pack blocked the whole Vista SP1 installation! So I quickly uninstalled the language pack, which solved my problem.

For those interested, here are the instructions for uninstalling a Vista language pack:

  1. Click Start, and then click Control Panel.
  2. In Control Panel, click Clock, Language, and Region, click Regional and Language Options, and then click Change display language.
  3. On the Keyboard and Languages tab, click Install/uninstall languages under Display language.  If you are prompted for an administrator password or for confirmation, type the password, or click Continue.
  4. In Choose to install or remove languages, click Remove languages
    Under Select the languages that you want to remove, select the language that you want to remove, and then click Next.
  5. Click the language that you want to remove, and then click Remove.

Vista SP1 RTM now available for download!

There are going to be a lot of blog postings on this subject, so I thought I might do a short one too… 🙂

You’ve read the title: A couple of hours ago Microsoft has made Vista SP1 officially available for download for both MSDN and TechNet subscribers.

Here are the download links:

Have fun!

Update: I encountered a problem related to an installed Vista language pack, which prevented me from installing Vista SP1. Read more about it here.

Free e-book: The Developer Highway Code

Today I stumpled upon my TechEd 2007 goodie bag and found a little card I had picked up somewhere at the event. The card advertised a free prize draw (twenty copies of Vista Ultimate). All you had to do was download The Developer Highway Code, whatever that might be.

The Developer Highway Code Cover ImageOfcourse being Dutch means I’m always in for a free prize draw, so I immediately visited the URL printed on the card. It turned out The Developer Highway Code is a cool free e-book released by Microsoft (available in PDF and XPS format). It seems to have been around since 2006, but I hadn’t heard of it before. The book was written by Microsoft UK employee Paul Maher and Alex Mackman and has been revised in 2007 (probably right before TechEd). Here’s the official description, which you can find on the book’s website:

"To build software that meets your security objectives, you must integrate security activities into your software development lifecycle. This handbook captures and summarises the key security engineering activities that should be an integral part of your software development processes.

These security engineering activities have been developed by Microsoft patterns & practices to build on, refine and extend core lifecycle activities with a set of security-specific activities. These include identifying security objectives, applying design guidelines for security, threat modelling, security architecture and design reviews, security code reviews and security deployment reviews."

Unfortunately the free prize draw seems to be over, but the e-book is still available. I suggest every Microsoft developer to take a look at it, since it’s a very good summary of many things a developer should look at when developing secure applications.

Blurry WPF editor in Visual Studio 2008

A short post this time…

Ever wondered why Visual Studio 2008’s WPF editor shows up kinda blurry on your CRT monitor? It turns out it’s a WPF control itself (as you had probably already guessed). But did you know that this also means it makes use of ClearType, even if you haven’t got an LCD monitor hooked up? Read all about it at Todd Mancini’s blog.

Search e-mail at lightspeed: using Lookout with Outlook 2007

Everybody who uses Microsoft Outlook must know that Outlook’s search functionality sucks. Yes, I know that’s a bold statement, but there’s no other way to say it. Outlook search sucks big time, period! Even Joel agrees… My mailbox is growing every day and I find it harder and harder to keep track of its contents. A search through my archived folders often takes a much as a full minute of searching, which I find unacceptable. In the press I often read Microsoft Corporation finds Search important and lately we’ve seen them release some impressive search products (i.e. Search Server 2008 and Search Server 2008 Express). Also a major part of my daily job involves implementing SharePoint 2007 solutions at our customers, which most of the time also includes SharePoint’s search feature. But somehow the Outlook team seems to have missed the boat…

Some years ago a guy called Mike Belshe created a great free Outlook add-in called Lookout, that offered a lightning fast search. Within seconds of starting a search (often even within a second!) the results would appear on screen. Microsoft was quick to buy his company and its technology. At that time many people expected Microsoft to integrate Lookout into Outlook, but unfortunately they seem to have shelved it (Mike himself claims some of his Lookout code ended up in Windows Desktop Search). So now there’s no official way to obtain Lookout. Luckily there are many sites that still offer the Lookout download. A quick search on Google should point you to some sites containing working download links.

However, getting Lookout to work with Outlook 2007 is more problematic. It turns out that Lookout checks for specific Office Primary Interop Assemblies (PIAs) and the PIAs that come with Outlook 2007 don’t pass this test. The result is that Lookout prevents itself from running under Outlook 2007 and instead displays this warning message:

Lookout error message

After much demand Mike Belshe published a way to get Lookout to work with Outlook 2007. For this you have to rename an Office PIA file, which resides in the Global Assembly Cache. While this solution gets Lookout to work, it may have serious impact on other applications/add-ins that make use of this PIA. So this solution isn’t acceptable for me (and it shouldn’t be for you!).

Instead I opted for a different approach. The only reason that Lookout doesn’t run on Outlook 2007 is that dreaded PIA check. So why not remove it? Which is exactly what I did…

A quick Reflector session revealed that the code that performs the PIA check is located inside the assembly named Inventures_Olk.dll and goes by the name of CheckOutlookInterop(). What it does is compare the installed Office PIA’s name to a built-in string constant. If the match is positive it returns the boolean value true, otherwise it returns false. Using ILDASM I decompiled the assembly to CIL, changed CheckOutlookInterop()‘s code to always return true and recompiled the assembly. So that gave me a fully working Lookout version that’s compatible with Outlook 2007!

You can download the patched assembly here. Just replace the the original Inventures_Olk.dll with the patched version and you should be searching your Outlook 2007 content a lightspeed in no time…

Oh yeah, there’s one small issue… It seems Lookout crashes while indexing if you run it on Vista. Bummer…

Update: Recently I discovered there’s another bug in Lookout that causes dates to be parsed incorrectly if you have the .NET Framework 2.0 installed. You can read more about it here. Fortunately someone has fixed this problem and also released a patched DLL that you can download.

Update 2: The DLL I patched and offer on this blog should work with Lookout version 1.3.0.24057. But as I understand that version of Lookout crashes during indexing on Vista and Windows 7. In the comments below user Stroth claims he got my patched DLL working with an older version of Lookout, a version that also works with Vista and Windows 7 and doesn’t crash. That’s good news, however I never tested that.

Visual Studio 2008 and SQL Server 2005 Business Intelligence Development Studio

As soon as Visual Studio 2008 went RTM I installed it and removed Visual Studio 2005 from my system. As you might know VS2008’s new multi-targeting feature can target .NET Framework 2.0, 3.0 and 3.5 and should be fully backwards compatible with VS2005, so in theory there shouldn’t be any need for keeping VS2005 around*.

However, today I encountered an unexpected situation where I did need VS2005. I tried to launch the SQL Server 2005 Business Intelligence Studio, which failed miserably… As you may know Business Intelligence Studio makes use of the VS2005 IDE (it uses either an existing “normal” Visual Studio installation or it installs the Visual Studio Premier Partner Edition). I knew this, but I had expected it to somehow automatically (or magically :-)) switch to the VS2008 IDE, which ofcourse it did not.

Unwilling to re-install SQL Server 2005 I searched the internet for a solution to this problem and stumbled on a thread on the MSDN forums discussing this exact same issue. It contains an interesting reply by Microsoft employee Dan Jones. There he explains a way to install the VS2005 files need without the need for re-installing SQL Server 2005. Here’s the trick:

  1. Go to the location for SQL Server setup and run .ToolsSetupvs_setup.exe. This will install the VS Shell.
  2. Repair the Business Intelligence Studio installation by running the following command from the command line from the .Tools directory (note: this should be typed on one line):
    start /wait setup.exe /qb REINSTALL=SQL_WarehouseDevWorkbench 
    REINSTALLMODE=OMUS

I hope this helps some of you facing this same issue.

* In practice I recommend you still keep VS2005 installed, especially when doing team development. If you open a VS2005 solution in VS2008, it will ask you to convert existing solution files to the new VS2008 format. Once converted, these updated solution files cannot be used in VS2005 anymore.I actually asked Scott Guthrie a question about this on his blog and even got a reply from him. Here’s what he had to say (for the original reply search the comments on this blog posting):

Hi Leon,

> Hey Scott, I noticed VS2008 wants to
> convert my existing VS2005 solutions.
> Why? The problem is that the converted
> solutions cannot be opened in VS2005 anymore,
> which some of my team members still use. I
> thought VS2008’s multi-targeting support didn’t
> require me to have VS2005 installed anymore,
> but now I still have to install them side-by-side.

VS 2008 allows you to target .NET 2.0 projects, but does make some changes to your solution file (that prevents it from being opened with VS 2005). What you can do, though, is maintain two solution files that point to the same projects and have them work with both VS 2005 and VS 2008.

Here are some blog posts that cover this more:

www.west-wind.com/…/122975.aspx

stevenharman.net/…/multi-targeting-vs2005-and-vs2008-web-application-projects-a-gotcha.aspx

codebetter.com/…/enabling-team-development-with-vs2008-2005-mix.aspx

Hope this helps,

Scott

Yeah Scott, it did!

SharePoint Service Pack 1 released!

Today Microsoft released the 2007 Microsoft Office servers Service Pack 1 and the 2007 Microsoft Office servers Language Pack Service Pack 1 (whew, what a long title… ;)). Although it contains fixes for all the Office System products, I’m mostly interested in the SharePoint 2007 (i.e. WSS 3.0 and MOSS 2007) Service Packs. We’ve been waiting some time for them now…

Joel Oleson did the official announcement. Here are some direct links to the goodies:

Before you install the service packs you might want to visit the SharePoint Products and Technologies Service Pack 1 Resource Center and read this and this.