Archive

Microsoft announced today that it will be releasing the source code for the .NET Framework in the VS 2008 time frame later this year. No, it’s not going open source — instead it will be covered by something called the Microsoft Reference License. The intent is to allow us lowly developers a peek into the inner workings of the framework for debugging purposes.

VS 2008 will also provide an integrated debugging environment where missing bits of source code are downloaded automatically.

Bookpool.com has all Apress books on sale at 50% off list price. It’s a great time to pick up my Pro WF book if you don’t already have it. Since it’s also published by Apress, my .NET Interop recipes book is also on sale.

One of the readers (Andrew) of my Pro WF book recently had a question about page 114 of the book. This page contains the code for a custom activity validator class that enforces design-time requirements. In this example, I wanted to make sure that two properties of the target activity were set at design-time.

Andrew pointed out that the code only accepts statically set values for the properties. If you set these dependency properties by binding them to another property, the validation fails. He’s right. That particular example code only demonstrates how to validate against statically set values.

To solve the problem, all you need to do is call the IsBindingSet method of the base Activity class. Here is the revised code from page 114 (Listing 3-11) that now works for statically set or bound property values:

So, I’m starting to do a bit of embedded Windows development again. For this particular project, the target environment will probably be CE 6.0, so I went ahead and installed the CE 6.0 Platform Builder (eval) on my system.

My first goal was to make sure that I had a decent development environment, including a CE 6.0 emulator that I could use to test and debug my app from VS 2005. It looked like PB for CE 6.0 supported the creation of an SDK and that SDK could include an ARMV4I emulator. Great — that sounds like exactly what I needed. I quickly configured and built an OS image along with an SDK. Everything was looking good.

I installed the SDK and saw that my new CE device and emulator were available for selection within VS. Still looking good. I threw together a quick test app and hit F5 to start debugging. I selected my new emulator as the target device and waited. And waited. And waited. The emulator (version 2) started, but the OS wouldn’t deploy or boot — all I had was an emulator with a black screen and VS just sitting there hanging, trying to deploy the OS image.

Since I didn’t have much experience with this process, I figured I must be doing something wrong. Probably something very simple. After all, I was able to start the emulator and boot the image under Platform Builder, but not from my C# app in VS.

After about 2 days of researching the problem, it turns out that the KITL option in the CE 6.0 image was the problem. KITL is Kernel Independent Transport Layer and is used to debug CE devices. According to this post and a couple of others that I found, KITL and DMA (which is used by VS 2005 to communicate with a device) don’t mix very well. The solution is to turn off the “Enable KITL” option in my CE 6.0 image.

I rebuilt my image and SDK, reinstalled the SDK and tried again. This time the emulator booted up just fine, followed by my test app. Perhaps this is documented somewhere and I just missed it. In any case, thanks to Barry Bond at MS who posted this solution. He really hit one out of the park on this one (sorry).

One of the new WF-related features in Visual Studio 2008 (Orcas) is the ability to new-up objects from within a rule. Previously, this seemingly simple task of creating a new object wasn’t possible within a rule. Now it is.

To illustrate this new feature, consider the following contrived example. Assume that you have a workflow that must return an instance of the following class:

Previously, your workflow could use a PolicyActivity and implement a few rules, but you would have to create an instance of this class in code instead of in the rule. However, now you can implement a rule that directly creates an instance of the object like this:

Condition:
System.DateTime.Now.DayOfWeek == System.DayOfWeek.Monday
Then Actions:
this.MyWFResult = new NewUpRules.MyClass("Starting a new work week")
Else Actions:
this.MyWFResult = new NewUpRules.MyClass("Some other day")

The MyWFResult variable is assumed to be a workflow variable that is used to return the resulting instance of MyClass to the host application.

But you’re not limited to creating objects in the rule actions. You can also new-up objects in the Condition portion of the rule. Consider this class:

A DateTime value is passed to the constructor of this class, and an IsStartOfWorkWeek property is defined which returns a Boolean. With the VS 2008 enhancements, you can now create an instance of this class and use it in a rule condition like this:

Condition:
new NewUpRules.MyDayOfWeekChecker(System.DateTime.Now).IsStartOfWorkWeek
Then Actions:
this.MyWFResult = new NewUpRules.MyClass("Starting a new work week")
Else Actions:
this.MyWFResult = new NewUpRules.MyClass("Some other day")

Granted, this isn’t the most exciting new feature in Orcas, but I do think it is a welcomed change that improves the rules capabilities in WF. Note: All of this code works in Beta 2 of Orcas.