Test Your HTML with the W3C Markup Validation Service

A co-worker asked me today about an issue in a Web app in which pages display correctly in IE 6.0 but incorrectly in IE 5.5.  He could duplicate the problem in IE 6.0 by changing the page’s <DOCTYPE> tag.  Sometimes issues like this are due to rendering engine differences (or bugs) in various browsers.  However, I very often see developers test the code and functionality of their Web pages, but fail to test the HTML.

There are far too many Web pages out there that have broken and/or sloppy HTML.  I know, I know, you have a deadline to meet and as long as it works on your computer it’s fine, right?  Hopefully that’s not your attitude.  There’s an excellent, free tool from the W3C that can quickly and easily validate your HTML and give you a list of errors and issues.  You can quickly jump to the trouble spots and make corrections.

The W3C (World Wide Web Consortium)’s free Markup Validation Service can validate HTML, XHTML, MathML, SMIL and SVG documents, and it is still being tweaked and improved.  I highly encourage you to add it to your Web development toolkit.

Enterprise Library for .NET 2.0 Finally Arrives!

Updated 1/20/2006

I hope you’re not still using the Microsoft Data Access Block and sibling Blocks in your code.  If you are, I hope you have a good excuse!  Microsoft released Enterprise Library for .NET 1.1 about a year ago to replace the old Blocks.  It was co-developed by Microsoft and Avanade, and Avanade still carries on a proprietary enhanced version called ACA.NET.  The former Blocks that were incorporated into Enterprise Library gained a more unified programming and extensibility model, improved documentation and samples and an extensible GUI configuration tool.  We used Enterprise Library throughout most of 2005 on a large WinForms app, and it worked great.  I recommend it to every .NET development team.

Since then, I’ve moved on to Visual Studio 2005 like many of you, and we’ve all been (patiently?) waiting for Microsoft patterns & practices to rework Enterprise Library for .NET 2.0.  A couple deadlines passed with no code, but it’s finally here.  You really owe it to yourself and your dev team to check out the excellent work being provided by the patterns & practices team.

ASP.NET 2.0 Master Pages Design Templates Set

For the graphic-design challenged among us, Microsoft has released a set of Design Starter Kits and XHTML 1.1 Strict-compliant HTML templates for ASP.NET 2.0.  These are not coding best practices kits — they demonstrate Web UI standards-compliance and best practices using CSS and XHTML.  Many of them look really sharp, and most of us developers need the help using CSS and XHTML correctly to create great looking pages.

.NET Framework 1.1 and 2.0 Side-by-Side (SxS)

December 18, 2006 Update: You may find my post on .NET 3.0 compatibility useful.

As a part-time systems engineer, I was very concerned about possible negative effects of installing the .NET Framework 2.0 side-by-side with 1.1 on our Windows Server 2003 boxes that run things like SharePoint Portal Server, Windows SharePoint Services and Exchange 2003.  I’ve searched and searched, and it seems like Microsoft is making little effort to document .NET Framework 2.0 compatibility with their server products.

It helps to understand how different types of executable code load the Framework.  Unmanaged applications that host the Common Language Runtime (CLR), that is, non-.NET applications that manually load the CLR in order to run .NET code, always load the newest installed version of the .NET Framework by default.  This behavior directly impacts SharePoint Portal Server, as one example, in a negative way.  Some unmanaged executables in SPS host the CLR, so as soon as you install 2.0 and restart the SPS apps, they will load 2.0, not 1.1 as they were designed and tested against.  BAD!

Fortunately, managed applications behave better.  A managed application that was built against 1.1 will continue to load 1.1, as long as 1.1 is installed.  (On Windows Server 2003 you don’t have a choice, but on other OS’s you can uninstall 1.1.)  A managed application that was built against 2.0 will only load 2.0.  If you uninstall Framework 1.1, your 1.1 managed app will now load 2.0 instead.

Confused?  When Microsoft doesn’t document which unmanaged apps host the CLR, the bottom line is that you need to be careful installing 2.0.

If you identify an unmanaged app that hosts the 1.1 CLR and you want to install Framework 2.0, there is a way to force the unmanaged app to load the old Framework:

  1. Locate the unmanaged EXE, and in the same directory, create (or edit) a text file called <unmanagedexename>.exe.config.  Ex: myapp.exe needs myapp.exe.config.
  2. Paste this text into the new text file (or merge it into the existing file; you may already have <configuration> and/or <startup> elements):
    <?xml version =”1.0″?>
    <configuration>
      <startup>
        <supportedRuntime version=”v1.1.4322″ /> 
      </startup>
    </configuration>
  3. Save the config file and start or restart the EXE or service

Installing the 2.0 Framework without adding or updating the config files will affect SharePoint Portal Server and BizTalk Server 2004.  BizTalk Server 2006 natively runs on, and requires, .NET Framework 2.0, and runs just fine with .NET Framework 3.0 as well.

To safely install 2.0 on your BizTalk 2004 server:

  • Add (or update) a config file for each EXE in your BizTalk 2004 installation folder
  • Reboot or restart all BizTalk services
  • Review Microsoft’s KB
  • After installing Framework 2.0, ensure that all BizTalk Web services remain configured to run under ASP.NET 1.1.

To safely install 2.0 on your SPS servers:

  • Add (or update) a config file for each EXE in your SPS installation folder
  • I recommend installing WSS 2.0 SP2, which explicitly supports ASP.NET 2.0, and then SPS 2003 SP2.  If you are not ready to upgrade, you can still add the config files and safely install 2.0 on SP1 or earlier.
  • After installing Framework 2.0, ensure that all SPS portal Web sites remain configured to run under ASP.NET 1.1.  SPS SP2 does not support ASP.NET 2.0, even though WSS does.

To safely install 2.0 on your Exchange 2003 servers:

  • Exchange Server 2003 doesn’t appear to host the CLR, so it should be safe to install 2.0 on Exchange front-end or back-end servers.  I installed it on our front-end server with no issues.
  • After installing Framework 2.0, ensure that the OWA Web site remains configured to run under ASP.NET 1.1 (IIS Admin, site properties, ASP.NET tab).

Installing .NET Framework 2.0 installs ASP.NET 2.0.  By default, this will not change existing IIS Web sites to 2.0 — they will remain set to 1.1/1.0.  You can control this in IIS Admin in the site properties under the new ASP.NET tab.  Do not try to mix ASP.NET 1.1 and 2.0 apps within a single AppPool on Windows Server 2003.  Create separate AppPools for each version.

Office 2003 is unmanaged but does host the CLR, so it may also be affected by installing Framework 2.0.  There are known issues with Office 2003 when loading add-ins, smart tags or smart documents created with .NET Framework 2.0.  There is also a related VS2005 update for Visual Studio 2005 developers.

Visual Studio .NET 2003 developers may experience trouble in certain cases after installing Framework 2.0.  One such issue is fixed in .NET Framework 1.1 SP2.

The Framework documentation briefly, and poorly, discusses the side-by-side issue here.

I would appreciate comments on this post!  Is it helpful?  What information can I expand on?  Are there other issues that you are concerned about or have experienced?

Background Compilation in Visual Studio 2002, 2003 and 2005

Background compilation is a feature of the Visual Studio IDE.  It includes a special version of the language-specific source code compiler that runs continuously on a background worker thread.  Each time you make a change in the code editor, the background compiler wakes up and attempts to compile the code.  This is the feature that’s responsible for the squiggly marks under code in the editor and errors in the Task List while you’re writing code.

Microsoft first introduced background compilation to the Visual Studio.NET 2002 IDE for VB.NET projects.  The other languages did not ship with background compilers.  Most of the time background compilation is a great productivity enhancer, alerting you to your errors immediately.  When you switch back and forth between VB.NET and C#, for instance, you really miss this feature.

Unfortunately, background compilation tends to be the most unstable portion of the IDE.  Have you ever been working in a VB.NET project when the IDE suddenly crashes with “unexpected compiler error?”  Have you had the compiler suddenly begin informing you that variable xyz is not defined, when you’re looking at the declaration on screen?  You’ll find that when you restart the IDE, these errors magically disappear.  These issues are all due to bugs in the background compiler.

The most amazing thing about these bugs is that Microsoft virtually denies that they exist.  At least 80% of the VB.NET projects I’ve worked on have experienced these problems once the code base grows beyond trivial size.  While I was working for Microsoft, I found records of the background compiler bugs in their internal bug tracking database.  There is even a hotfix for Visual Studio.NET 2002 and 2003 that addresses some of them.  However, this hotfix was never made publicly available.  We eventually obtained it from Microsoft PSS, and I’ve carried it with me from client to client ever since.  It doesn’t fix all the bugs, but it’s better.  It amazes me that there was never a service pack for VS.NET 2003.  I’ve heard that one may be coming — now that Visual Studio 2005 is released and people are moving away from 2003.

With the introduction of Visual Studio 2005, both VB.NET and C# include background compilation.  And guess what?  Reports are already coming in [more] that the C# background compiler crashes in certain situations, some involving the use of generics.  Thankfully they also added AutoSave to the 2005 IDE.  The unofficial timeline for Visual Studio 2005 SP1 is sometime in mid-2006.

In short, background compilation is a great productivity enhancer, but is not without its problems.

%d bloggers like this: