Workaround for Known Issue with TypeConverters in DSL Tools for Visual Studio
Tags: dotnet, dsl, orcas, visual studio, vsx6 Comments »
When I tried to add a Domain Property with a custom TypeConverter to my Domain Class I ran into serious problems. Sometimes it worked and this property was shown correctly in the properties window using the custom TypeConverter, but sometimes not. I was desperately searching for a bug in my code for hours but then I figured out: Each first build after a solution cleanup was working and all other builds not. Even when I start the working build a second time without rebuilding it, the custom TypeConverter was not used.
This looks very much like the number 1.10 (the second 1.10 😉 ) in the known issues list posted on the VSX Team blog:
1.10 TypeConverters and TypeDescriptors are not picked up during the build process or during toolbox initialization.
When adding a custom TypeConverter or TypeDescriptor and then building the DSL, the TypeConvertor or TypeDescriptor is not picked up. The workaround is to rebuild the solution with a clean build.
And as you see: I discovered this workaround for myself, too. But I also found another workaround. I’m not sure if it is working for all situations with the described known issue but if you have the same problem you might want to try it. If it works or not, please comment some feedback here.
I simply used another constructor of the TypeConverterAttribute
. Instead of providing the type information I used the constructor with a string:
// this one does not work:
[TypeConverter(typeof(DynamicPropertiesTypeConverter))]
// this one is not nice, but works:
[TypeConverter(“BenjaminSchroeter.DynamicPropertiesTypeConverter”)]
public class DynamicProperties : ICustomTypeDescriptor
Recent Comments