开发者

Getting TypeConverter error that makes no sense

I have a TypeConverter for a TopMostNode class. It extends ExpandableObjectConverter. The To开发者_StackOverflow社区pMostNode has two properties. Setting those in the property grid results in correctly serialized code to the designer. However, if I type in text for the property, I get a "Property value is not valid" error and the details say:

Object of type 'TopMostNode' cannot be converted to type 'TopMostNode'.

I'm baffled. When I step through the type converter ConvertFrom code, it runs as expected. I don't even know were to start looking for an issue like this.


You probably have two different versions of the same assembly loaded.


I had the same problem while developing a control for the .NET Framework 4.0 client profile, when all the design-time functionality was in a separate DLL. The problem appeared when I loaded both projects (the core control and its design-time part) as one solution into VS. However, all worked fine when I tried to use the compiled production version of my control in other projects.

The conclusion is the following: before starting to debug your TypeConverter code, try to use the compiled version of your control outside of the control development projects.

P.S. To get the design-time functionality available for my control while developing it, I placed the design-time part DLL into the PrivateAssemblies folder of VS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜