1
Vote

ToolWindow code generation bug?

description

Hi all, I wil repost here what I have posted in Negm's blog to make sure you guys know about it:
 
Just one warning to dsleditor users out there. There is a bug in the dsl editor powertoy that may be tricky to find. I haven't checked if this is new in 1.1 or was already there in 1.0.
 
In ToolWindow.tt the Guid for the ToolWindow is placed on the BASE class. This causes regpkg for instance to use the System.Type.GUID property of the class to generate the registration file (wix in my case).
 
This Guid is not stable and can change when changing namespace of your class (as well as some other factors).
When, like me, you use custom installers this will cause a desynch between the registry entries your installers create and the ones that are needed. Symptom: your DslEditor ToolWindow will be shown as an empty grayed out window without a name or not show up at all when using the menu command.
 
I traced it back to the cause described above after debugging and receiving an 80004005 (when converted to a hex string) HResult from the FindToolWindow method (this is called in ModelingPackage.GetToolWindow).
 
Modifying ToolWindow.tt to place the GuidAttribute on the proper class will prevent this and stabilize the registry that makes your designer work.
 
Hope this helps some people out there who are like me banging their head into the wall trying to figure out why their editors stopped working...
 
Cheers,
Anton

comments