Workaround for Known Issue with TypeConverters in DSL Tools for Visual Studio

Tags: , , , ,
Add 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

 

4 Responses to “Workaround for Known Issue with TypeConverters in DSL Tools for Visual Studio”

  1. Ticklish Techs » Blog Archive » Adding properties to Domain Classes at runtime with DSL Tools Says:

    [...] is a known issue and a workaround I described here with the TypeConverterAttribute and the DSL [...]

  2. Francesio Says:

    Great page.., man

  3. Một số bài học về DSL sưu tầm(luôn cập nhật) « IT Technology Says:

    [...] 1. Workaround for Known Issue with TypeConverters in DSL Tools for Visual Studio [...]

  4. Ticklish Techs » Blog Archive » Workaround for Known Issue with TypeDescriptors in DSL Tools for Visual Studio Says:

    [...] time ago I posted a workaround for this problem with the TypeConverter, but today a realized that this workaround does not work [...]

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in