Found an interesting trap when configuring settings for a screensaver I’m working on. In Visual Studio, you can configure Settings for your project - there’s a dedicated page of project properties just for this purpose:
The whole mechanism is pretty seamless - user settings are automatically stored as an XML file located in the users profile, and you (the developer) don’t have to deal with finding special folder names and building paths and so on.
What isn’t totally clear at first glance is that you aren’t limited to the standard set of data types:
At the bottom of the list, you can select Browse and enter the name of any class you like.
Tonight though, I kept getting this error message as I tried to configure my Settings:
This, despite clearly having the required class as a part of my project …
Have you spotted the problem?
The message “Type ‘mandelbrot.ScreenSaverSetting’ is not defined” is misleading, for the problem isn’t that the class is missing, the problem is that for a class to be used for settings, it must have a parameter-less constructor. As soon as I modified the class appropriately, everything went just fine.
Comments
blog comments powered by Disqus