While writing a barebones js lib to provide intellisense enabled access to WCF JSON endpoints using the /js and /jsdebug mapped endpoints, I came across a bug in System.Web.Script.Services.ClientProxyGenerator.
I was wondering why all of the enums that were generated were marked as Flag when they clearly were not. The reason this is an issue is that if you want to .parse or .toString an enum and it is incorrectly marked Flag your results are going to be wrong.
The ramifications of this can vary from annoying to disasterous. Say you want to display people friendly value of an enum returned from a service call. Incorrect values are going to be confusing and likely break the script. Say you decide to update a record with a mangled enum... bad juju my friend.
The bug is in GenerateEnumTypeProxies. At the tail end, as an obvious afterthought, the field that declares the field as Flag or not is hardcoded true. I would expect an attribute check here.
I have submitted a
bug on Connect. Let's see how serious they take it....
Technorati tags:
Ajax,
WCF,
BUGS