Sunday, March 20, 2005

FxCop on the Compact Framework

No comments:
To check the PocketPC barcode scanning applications I just wrote, I downloaded FxCop.

The first issue reported, the missing strong name, I addressed with the help of this article (actually, there are a lot of articles - but this one got me started quick). Also I needed to move the generated files into the same directory as my executables.

Some FxCop rules are not applicable in the compact framework. This article has more info, as does searching the related forums.

ToString generates a SpecifyIFormatProvider FxCop error. A good discussion of why can be found here. Quick solution: use ToString(CultureInfo.CurrentCulture) for things that users will see, and ToString(CultureInfo.InvariantCulture) for things that the need to be parsed by the computer in a cultural independent way.

Ha! After inventing Hungarian notation, Microsoft now has a rule against it! Since they don't provide justification for this change, and it seems like more of a style thing, I added my "hungies" to the FxCop "custom dictionary" - see their docs for details. This allows me to keep the GENERAL rule (no misspellings in the name) without having to stop using Hungarian notation.