WorkItem.Workspaces container is empty, causing Null reference exception

Topics: CAB & Smart Client Software Factory
Feb 8, 2007 at 8:25 PM
Edited Feb 13, 2007 at 6:36 PM
Trying out the CAB recipies, I've created a simple application, added two modules and some views. Made minor changes to the Infrastructure.Layout ShellLayoutView that was autogenerated. Now at runtime in Infrastucture.Layout's Module.cs, the second of the following lines that were generated by the recipe causes an exception. Note the _shellLayout is created just fine, the problem is that the Workspaces collection is empty, so .Show() fails with a null reference exception.
ShellLayoutView _shellLayout = _rootWorkItem.Items.AddNew<ShellLayoutView>();

The exception is because the _rootWorkItem.Workspaces collection is empty! I went back to an earlier version of my code that works, and the collection has exactly one Workspace at the time this code is reached, and it is the one being referenced here. But I can find no code generated by the recipe that actually places the workspace into the collection. So I cannot debug this.

I am very new to the CAB, but I have studied the diff between the modules that work and those that don't, there must be something I did that has broken something, but it does not manifest itself until this line of code... Certainly no line of code adds the workspaces to the rootWorkItem that I can find...

Any insight into how this Workspaces collection gets populated may point me in the right direction. Perhaps tracing would help? If someone knows a simple way to turn on tracing of what the CAB software is doing, that would be great. I'll start looking into that myself now...

UPDATE 2/13/2007
I started a new project, moved my code over, and it works. I'm not sure this would be the best way had the project been more than a few days old...