Infosys Microsoft Alliance and Solutions blog

« July 2007 | Main | September 2007 »

August 21, 2007

Silverlight on VS 2008 Beta 2 VPC

The other day I decided to try my hands on building a Silverlight application using the Alpha 1.1 refresh on my newly downloaded VS 2008 Beta 2 VPC. I built an extremely trivial application with a text box to display some text. However on running, I didn't see anything and didn't get any error as well. I played around with the text foreground color, visibility and opacity properties but no luck. I could see things fine in the Expression Blend.

So what was wrong and why was IE not displaying it. I then found that this is due to the Enhanced security configuration for IE. I didn't get any warning. Probably when the VPC was built the Continue to prompt when Web site content is blocked option was unchecked !! Anyway, removing the enhanced security configuration did the trick and the application started to work properly.

August 10, 2007

VS 2005 Debugging Issue with AJAX Applications on IIS7 on Vista

I wanted to play around with AJAX and hence downloaded the Extensions and the ToolKit. I created a new ASP.NET AJAX Enabled Web Site and after adding the Update Panel to update a label control, I hit F5. Surprisingly, I got an error when trying to debug.

This was easy to fix and happens for all web sites built using VS 2005 that you try to debug on IIS7. The site should have Windows Authentication enabled. I did that change and tried to debug again but still got an error as authentication error. There is description of a related hotfix here. However I was working on Vista Ultimate so wasn't sure if this hotfix will work for me or not.

For some other work, I had altered the DefaultAppPool setting for applications and I decided to give it a try as well. Steps to alter the application pool

  1. In IIS7 Admin Console, click on the site in question
  2. In the right side "Action" panel, click on "Advanced Settings"
  3. In the dialog that comes up, change the Application Pool from "DefaultAppPool" to "Classic .NET App Pool"

With these changes, I was able to debug the ASP.NET AJAX application without having to install any hotfix.

Surprisingly, a little later, when I changed the Application pool back to "DefaultAppPool", I was still able to debug without any authentication errors again !

August 2, 2007

WPF and AppDomains

In my earlier blog I had talked about how to work with AppDomains and the issues I had faced. I had a chance to interact with Hua Wang from Microsoft and it was very enlightening.

There are specific things that need to be taken care when creating and destroying AppDomains in WPF. .NET framework 3.0 supports new APIs for this purpose and these are to account for the threading model of WPF.

WPF uses the concept of Dispatcher. The UI work is managed via the dispatcher and all work/messages are handled by it.

When a new AppDomain is created, a new  dispatcher is also created for it. Before we can shut down the AppDomain, we will also need to shut down the dispatcher. The AppDomain.Unload causes Thread.Abort in that domain and during the call the CLR tries to abort all threads. The Dispatcher thread is in the native mode and hence the CLR cannot abort it. It gives a few retries and then raises a CannotUnloadAppDomainException.

Suprisingly, in my initial testing, the AppDomain unload happened without a need to shutdown the dispatcher when i was using WPF extensions on VS2005. When I played around with Orcas Beta 1, I could see the exception getting raised.

The suggested solution is something like below

            if (ad != null)


                //Time to unload the app domain, but first shut down the dispatcher

                ad.DoCallBack(new CrossAppDomainDelegate(ShutDown));


                ad = null;



        static void ShutDown()




In the code above "ad" is the variable that stores the AppDomain that was created using AppDomain.CreateDomain. This solution is bound to work and I have tried it on VS 2008 (Orcas) Beta 2 as well

ASP.NET 2.0 - Fix Summary

Doug Stewart has provided a detailed listing of fixes for ASP.NET 2.0 that are available via hotfixes and .NET Framework 3.5 Beta 2. Check it out here.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter