Tuesday, July 31, 2007
The CLR Add-In Team Blog has just posted a list of the 7 new features that they have included in Visual Studio Orcas2008 Beta 2.

Tuesday, July 31, 2007 11:49:06 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, July 26, 2007

(this is just a post that I'm putting out there, when I Googled for the error I got nothing relevant, so this post is dedicated to the future searcher, whoever you may be...)

The error occured on a brand new install of Windows 2003 Server R2 w/ SP2 slipstreamed.  Oddly, this media set had installed another server without error, but anyway the error was:

Setup library netfxocm20.dll could not be loaded, or function UrtOcmProc could not be found.  Contact your system administrator.  The specific error code is 0x7e:

The solution was to reinstall the "R2 bits" (aka. Disk 2) and reboot.

I'm still looking for a log file or event log message or any clue anyware in the system to indicate why it went bad, but don't like my chances...

Thursday, July 26, 2007 5:58:16 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, July 22, 2007

It dawned on me today, why the same old song isn't working for the youth of today...

The message should not be that sex leads to pregnancy, but that sex leads to prams!

Yes, I'm talking about prams, strollers and buggies people!  You're killing me already!  I give in! 

That will be all :-)

Sunday, July 22, 2007 10:24:06 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, July 19, 2007

This is the third of my posts about group policy for web developers [part 1] [part 2], and today's post is a from-the-trenches tail about how you can get 401.1 Access Denied as a result of applying group policy.

Mad props to Jimmie Russ and his post Access Denied 401.1 goes away temporarily after IISRESET, as it was his post that sorted my problem today.

As you will see in his post, it is possible to push out User Rights Assignment policies via a GPO that can define the following rights:

  • Log on as a service
  • Log on as a batch job
  • Allow log on locally
  • Access this computer from the network

The above list may not be complete, but it was these four that caused a problem in my IIS environment.

Two tell-tail signs that this is your problem:

  1. If you run the always awesome AuthDiag utility and it reports that certain local accounts (like IUSR_*) have rights missing, specifically the ones listed above.
  2. When you view the User Rights Assignment in Local Security Settings
    • The above four rights are locked (have a little lock icon instead of the "blue 1s and 0s icon") and are not able to be edited.
    • The above four rights are not granted to our local accounts (again IUSR_* et al)

Again, it may not always be exactly those four - what you are looking for are policies that will not allow your IIS accounts (as listed in the AuthDiag results) to log on.

If I had my time again, I would have cranked up the failed security events and listed them here, but my servers are working again and I like it that way so this can be left as an exercise to the reader :-)

As Jimmie said, the solution is to have these rights not pushed down to your web servers.  This can be by not applying them in your Default Domain Policy, or by putting your web servers in a seperate OU blocking policy inheritance.  If you're not sure, consult an expert.

Thursday, July 19, 2007 4:39:09 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, July 18, 2007
Sorry to anyone who is waiting for an IM, email, phone call or anything from me... there is a burning smell coming out of a server :-(

If you need me, I'll be double-checking that I have valid backups...

Update:  The acrid smell I mentioned above was in fact the smell of fresh just-out-of-warranty power supply.  I even had to wash my hair to get the smell out.  All is OK now.  :-)

Wednesday, July 18, 2007 5:08:36 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, July 12, 2007

How to start?
You will need several assemblies.  This is because to reach the level of decoupling that is desired, the pipeline has a certain pattern of dependencies between projects.  I’m not sure if I am subconsciously not objecting to it or actually actively like this now, was not always the way.

A pipeline?
Yes, you need one. 

What is a pipeline?
It’s a series of folders that live somewhere (does not have to be under your application's path) and each of the assemblies have their place in the structure.  The folders will look like this:

It’s probably a good idea to build one now in your project tree and set the build output as you go.

There is a graphic explaining the pipeline on the CLR Add-In team blog (with nice colours), it is also in the Orcas MSDN under the title: "Pipeline Development Requirements".  The MSDN one has the addition of lines to indicate the static dependancies.

I've chosen to show it differently in my graphics (don't say a word!) to indicate the order of it all coming together as well as the references.  In the graphic the arrow lines illustrate the dependancies between the projects.

Also, I make reference to the sample code throughout this post.  Download link is at the bottom.

Step 1: Define Contracts

The first step is to define the contracts in your contracts assembly and DTOs in your DTO’s assembly.

Your contract should be one interface per kind of add-in you will support.  These interfaces need to inherit System.AddIn.Contract.IContract and be decorated with System.AddIn.Pipeline.AddInContractAttribute.

Types in the DTO that you wish to pass over the boundary will need to be serializable.

Jason He’s example of a Paint.NET Add-In (link below) takes a different path, by adding the extra types in the Add-In View, adding more wrappers.  His approach may have advantages that I have not discovered yet, but it reminds me of some of the dancing you have to do when for example you have the same type in a Web Reference and a binary reference in the same project. 

My preference is then to make a behavior-free separate assembly that anyone can take a dependency on safely.  This is the reason for including a DTO project.  I also like having the DTO types there to do as a [DataContract] does in WCF.  This will allow the Add-In contract to remain static if the host side changes it’s implementations of the DTO equiv. types.

Change the project properties of the Contracts project to build to: ..\Pipeline\Contracts\

Also note, for types that take a dependency on the DTO project, set the Copy Local property of the reference to False.  This is to keep the pipleline path clean.  i.e. we don’t actually want a copy of the DTO assembly in the \pipeline\contracts\ path!  This will slow our discovery and generate warnings as the Add-In infrastructure tries to examine it for contracts.

Step 2: Host View and Add-In View

Add two new assemblies:  host view and add-in view
Each has a public abstract class that mirrors the contract interface but does not reference it.

Host view does not even need a reference to System.AddIn.

When building the Add-In View, be sure to:

  • Apply System.AddIn.Pipeline.AddInBaseAttribute
  • Set the project to build to ..\Pipeline\AddInViews\

Step 3:  Host Adaptor and Add-In Adaptor

Add two more assemblies:  host adaptor and add-in adaptor

Add-in adapter will have one AddinToContractAdapter class for each Add-In type and the Host adapter has one ContractToHostViewAdapter class for each Add-In type.

The AddinToContractAdapter descends from System.AddIn.ContractBase and implements the contract for the Add-In

The ContractToHostViewAdapter descends from the Abstract class in the Host View for the Add-In.

Set the build output path of the Host Side adapter to: ..\Pipeline\HostSideAdapters\
And set the build output path of the Add-In Side adapter to: ..\Pipeline\AddInSideAdapters\

The purpose of these adapters is too marshal calls between the instances of your IContract's and should just look like wrapper code.

Step 4: Build the Add-Ins

Every Add-In needs to take a dependency on the Add-In View project and the DTO project.  Be sure to set their Copy Local = False in the reference properties.

Each Add-In also needs to descend from the abstract class in the Add-In View project, implement overrides, and to be decorated with System.AddIn.AddInAttribute.

The AddIn Attribute is the key to how the Add-In will be seen by the host so pay attention to the parameters on the constructor.

Set the build output path of each Add-In to: ..\Pipeline\AddIns\<addinName>\

I should mention that the Add-In's in the sample code below are just stubs to show the complete loop.  The Book Library Add-In returns empty objects of the prescribed types, the other two throw an Exception.  This is to show error handling.

Step 5:  The Add-In Host

Take a reference to the Host View and Dto projects, this time it is OK to have the reference Copy Local.

In the attached example the Book Library add-in returns empty objects of the designed type, however the other two (DVD Library and CD Library) throw an Exception for each operation. 

By the end of the process, the project will look like this:


Trouble shooting & Error Handling

Just skiming over this topic, but it is wise to wire up a handler to AppDomain.UnhandledException for the app domain that will run your Add-Ins, and Application.ThreadException (Windows Forms examples) as well as wrapping calls into the Add-In with a Try... Catch block. 

If you are trying to work out why your AddIns are not being discovered, remember that:

  • AddInStore.Rebuild()
  • AddInStore.RebuildAddIns()
  • AddInStore.Update()
  • AddInStore.UpdateAddIns()

...all return an array of strings that can be examined to determine how the AddIn discovery went.

Source Code:

The source code for this example is available for download from the following link:

LibraryAddInDemoCode_deepdark.net.zip (152.81 KB)

It requires Visual Studio Codename Orcas Beta 1.

Summary:

There are a couple of steps to implementing the new System.Addin stuff, but none of it is hard!

...and considering that it replaces a lot of very untidy and error-prone Reflection code that we had to do in prior versions of the framework I think this is a great addition to the toolbox.

This post is not meant to be a hardcore reference, just the total of my experience with this technology to date.  If you have any feedback please don't hesitate to contact me by email or leaving a comment on this post.

Sources:

Listening to: The Chillout Sessions 3

Thursday, July 12, 2007 5:18:15 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, July 11, 2007
I think this question is really suited to two kinds of people:
  1. Criminally insane.  Reckless to a point considered, well, imprudent. :-)  You lick the top of 9V batteries; you chew on tin-foil.  You cut your toe nails with a Leatherman.  You bank the farm on a technology that is still moving because pain is your friend.
  2. People who may ship a product before .NET 3.5 ships.  .NET 3.5 has some new technologies that I am going to want to use.  Three that are immediately relevant are: new Active Directory bits, System.AddIn, and the goldern haired child, Linq.

These are bits that (esp. Linq) I want to bake in.  Right now I don’t want to code up bits that I know I am going to have to rip out soon in order to replace with the richer platform.

My ship dates are uncertain… if the product name is anything to go by Orcas is at least 6 mths away.  The real question in this post is how to mitigate the risk of being ready to ship before the platform is, and what to keep an eye on.

Please feel free to leave a comment or email me if you have clues for the above question :-)

IIS 7 & Longhorn Beta 3 already has a Go Live license.  I believe them when they say it is good quality, and I believe them when they say it may still change.  Is a similar license something that we may see for .NET 3.5 as more betas or CTP’s become available?

UpdateFeb 27 2008 is looking like the launch date for SQL Server 2008, Visual Studio 2008 & Windows 2008.

Wednesday, July 11, 2007 2:34:36 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, July 08, 2007
One of Sydney's better book shops can'twon't sell me their only copy, but they abound on Amazon...

so is it that the dead-tree-copy version is not profitable, or... is it that the bricks and morter re-seller model for dead-tree-copy is the business problem?

What do you think?

Sunday, July 08, 2007 10:14:32 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Saturday, July 07, 2007

In UX terms, Dell's web site is pretty good.  Three and a half stars in my book.  However, I don't know about you, but I think the following post-purchase survey question should be select all that apply, rather than select one.

I just saw this question come up while my sister just ordered her new Dell Inspiron and I had to screencap it...

But Mr. Dell, I cried... What do I choose if I want to use it for MySpace, biological research *and* missile technology research...
UX | Funnies
Saturday, July 07, 2007 3:23:27 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, July 03, 2007

I have been noticing that CodeRush / Refactor Pro! are playing up every so often my shiny (well, dusty) new Vista PC.

The symptoms are minor, but annoying when you have your fingers trained :-)  Basically Smart Cut / Intelligent Paste stop working.

Turns out, the solution is on the Expert options:  Startup \ Re-register CodeRush commands with Visual Studio on next startup.  Easy!

...Then you can have all your pretty refactoring graphics back!

Tuesday, July 03, 2007 2:21:07 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
It became clear to me during my last blog post on the .NET landscape that it was going to grow into more than one post. 

Framework Versions

One fact that is important to note about the graphic in that post, and it was the catalyst for me making the drawing, is that the .NET 3.0 and .NET 3.5 frameworks do not supersede .NET 2.0 but augment it.

What I mean by this is if you were to look into your %WINDIR%\Microsoft.NET\Framework\v3.0 folder you do not get a new System.Data.Dll or System.Web.dll.  Instead you see the folders for:
If you look in your %WINDIR%\Microsoft.NET\Framework\v3.5.xxx\ (still beta at time of writing) the main thing to note here is a new csc.exe and vbc.exe.

So what do you get with .NET 3.5 & Visual Studio 2008 (codename "Orcas")?

Update:  Please also check out Daniel Moth's whole bunch Orcas posts, and his run-down of the new bits.

...and last but not least, the golden haired child, LINQ...

...and for everything that I have missed, or is not in the beta bits yet, grab the Orcas overview whitepaper.

What is .NET 3.5 going to do to 3.0?

It seems it has to do with Green Bits and Red Bits (source: Daniel Moth).  In other words, .NET 3.5 will also include SP1 for .NET 3.0 and SP1 for .NET 2.0.

Tuesday, July 03, 2007 9:11:18 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, July 01, 2007
When I started playing with LINQ, I needed to get some clarity on this in my mind, so in the spirit of Linnaeus, Mendeleev and Gell-Mann, I put together a graphic that showed the generations of the various bits, and after talking with friends thought it was worth sharing:

UpdateDaniel Moth has a better graphic for the same data on his blog first.  Shame, not an image map. :-)

Mohammad Adil Akif also has a version in his blog.

...This is the blog version - the original form was a Post-It note.
...And in the spirit of Web 0.9 (which came before Web 2.0 :-) the graphic is an image map :-)

I know there is much more coming, like the Dynamic Language Runtime, Domain-Specific Language tools, Silverlight, and so on.   I've also chosen not to call out the versions of Team System, both in the interest of clarity.
Sunday, July 01, 2007 11:51:05 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [1]  |