Salient Solutions

wrasslin ones and nones for fun and profit - Sky Sanders' Blog
Get your own ranked flair here
posts - 92, comments - 102, trackbacks - 0

ClientProxyGenerator incorrectly declares all enums as Flag

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

Print | posted on Thursday, February 18, 2010 5:33 PM |

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 8 and 3 and type the answer here:

Powered by: