Rendering ASP.NET Validators And Validation Summary Property As HTML Attributes

Yesterday I blogged about the cause of ASP.NET validators and validation summary slowness.

At that point I wasn't aware of the existence of the XHTML conformance configuration (thanks Nuno).

With the XHTML conformance configuration set to Legacy, the rendering of controls works like it worked in ASP.NET 1.1.

The Cause Of ASP.NET Validators And Validation Summary Slowness

When building ASP.NET pages, if you use too many validators and validation summaries your pages can become very slow. Have you ever wondered why?

Lets build a simple page web page with a few validators. Something like this:

Web page with validation

The page is composed of:

ASP.NET renders the ValidationSummary as a DIV and each validator as a SPAN and uses expando attributes to add properties to those elements.

According to the documentation, expando attributes are set dynamically from JavaScript to preserve XHTML compatibility for the rendered control's markup.

The problem is that all that JavaScript makes the HTML document larger and slower to execute than if the properties were rendered in HTML as attributes of the elements.

For such a small page, the difference in size approaches 2k bytes. If you add a few dozen validators to he page, the slowness is noticeable.

I'm all in favor of strict standards and standards compliance, but in this case, I wish XHTML would allow arbitrary attributes.

Build Your Own LINQ Provider

Mehfuz has been building a toolkit for creating LINQ providers and it's available at CodePlex: LINQExtender

He has even built a LINQ provider for flickr with it: LINQ.Flickr

The Architecture Tool Space Keeps Growing

The tool space for software architecture has been growing. There are new tools and continuous improvement in the existing ones.

Framework Design Studio

Last month Krzysztof Cwalina from Microsoft released the Framework Design Studio at MSDN Code Gallery.

The tool allows comparing two versions of an assembly to identify API differences: API additions and removals. Comparing versions of APIs comes very handy during API design process. Often you want to ensure that things did not get removed accidentally (which can cause incompatibilities), and as APIs grow, you want to review the addition without having to re-review APIs that were already reviewed. The tool, called Framework Design Studio (FDS) supports these scenarios. - from Krzysztof's blog post


Lattix keeps improving its Architecture Management System composed of two tools:

The Lattix tools can be used in the following environments:

The site has lots of resources on its getting started section that can be used to evaluate the tools:

  • Download a trial version of Lattix LDM
  • Take the tour
  • See a live Demonstration
  • Assess your software
  • Try a JumpStart project

The latest release (Lattix 4.1) was released on April 21, 2008.


NDepend, from fellow C# MVP Patrick Smacchia, targets only the .NET Framework (stay tuned for more) is also in continuous development. Its UI is more familiar for Microsoft Visual Studio and Microsoft Office users than Lattix's UI and a really cool feature:

The site has lots of videos (both on the Home page and Getting Started page) and documentation on all the concepts used by the tool.

The latest release (NDepend 2.8.1) was released on April 26, 2008.

ApexSQL Enforce

ApexSQL Enforce, from ApexSQL, targets SQL Server databases allows to:

  • Ensure adherence to design standards in "real time"
  • Facilitate upgrades to new versions of SQL Server by identifying potential conversion problems before the database is ported
  • Automatically reverse or fix detected violations using generated "FixSQL" scripts
  • Enforce Naming conventions and ensure that SQL reserved words and special characters are not used

The site has lots of product information:

The latest release (2008.02) was released on Marsh 26, 2008.

Framework Design Studio On MSDN Code Gallery

I just came across this today:

Framework Design Studio is a set of tools for reusable library designers. The package contains a GUI tool for viewing, reviewing, and comparing versions of managed APIs. It also contains a command line tool for generating API diff reports.

This seems to be a great tool to check if your new version of your framework will break any previous released APIs.

Although honoring the previously released APIs, your new version might have side effects and, to find out what they might be, there is another great tool: NDepend.

Upgrading the WCSF EventBroker Extension to WCSF 2.0

While preparing the demos for my session at TechDays Portugal 2008, I've noticed some changes in the Web Client Software Factory 2.0 that prevented the EventBroker Extension from compiling and running.

The problem ended out just being a little change in the WebClientApplication class. The virtual methods related to creating the builders changed.

To fix this, all it's needed is editing the WebClientApplication class (CompositeWeb\WebClientApplication.cs, line 35).

Just replace the CreateBuilder override:

protected override Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilder CreateBuilder(bool isSingleton)
    // Our builder adds an EventBrokerStrategy to the build.
    WCSFBuilder builder = new WCSFBuilder();
    builder.Policies.SetDefault<ISingletonPolicy>(new SingletonPolicy(isSingleton));
    return builder;

with an override of the AddBuilderStrategies method:

protected override void AddBuilderStrategies(IBuilder<Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage> builder)

Don't forget that if you want to run it in IIS7 Integrated Pipeline mode, you have a few more changes to make.

IE8 Beta 1 is out

If you want to download IE8 Beta 1 and test it, it's here. Read the Release notes and the IE8 Readiness Toolkit which will give a detailed description of the features.

If you have any feedback, use the feedback form, which allows you to submit bugs directly to the IE team!

Several updates have been made to the IE8: Technical Beta Program  available on connect. Check it out!

Also check out the IE team's blog:

.NET Reflector 5.1

.NET Reflector 5.1 is out.

The only thing new I've noticed different is improved user experience in my Windows Vista SP1 64-bit system. No more security prompts.

Upcoming Typemock Webcast on March 12

Typemock is having a special Webcast on Wednesday March 12, 16:00 GMT

The live demo will include:

  • The Support of the new .NET 3.5 framework and specifically how to mock LINQ statements.
  • The improved IDE based on using colors to emphasize mocked methods.
  • Seamless integration with  Microsoft’s Visual Studio 2008.

It is also an opportunity to meet Typemock’s development team, ask questions online and share some tips.

.....and one of you can win a Nintendo Wii during in the webcast!

Click here to participate in the Webcast

TypeMock Isolator 4.2 Released

TypeMock has released version 4.2 of its mocking framework: TypeMock Insulator. Check out the release notes.

My four favorite new features in this release are:

Improved mock chaining

(If you want to learn more about chains, read this post from Gil)

Take this class to be tested:

public class TestedClass1
    public IDictionary<string, object> Dictionary
        get { throw new NotImplementedException(); }

    public object Method(bool cond)
        if (cond)
            return Dictionary["true"];
            return Dictionary["false"];

The following test:

public void TestMethod1()
    object trueObject = new object();
    object falseObject = new object();

    TestedClass1 target = RecorderManager.CreateMockedObject<TestedClass1>();

    using (RecordExpectations recorder = RecorderManager.StartRecording())

        recorder.ExpectAndReturn(target.Dictionary["true"], trueObject);

    object value = target.Method(true);
    Assert.AreEqual(trueObject, value);

Would simply fail with:

Test method TestProject1.UnitTest1.TestMethod1 threw exception:  TypeMock.VerifyException: 
TypeMock Verification: Method TestProject1.TestedClass1.get_Dictionary() has 1 more expected calls

Now, it just passes.

Debugger evaluation doesn't change the test behavior

Now you can debug your code without having to change your tests. You can query mocked values without influencing your tests.

You can do this and still have the test passing:

Debugger Support

The debugger can be run inside a recording block without confusing the test

You can now step into the recording block and debug it without affecting the recording process and the test.

Recording Block

When you step in the debugger into a mocked method, the mocked method will be painted

When you step into a mocked method (or property) I'll see that it's mocked.

Visual Studio Cues