Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any expression starting with [ is considered a numeric expression #71

Open
GoogleCodeExporter opened this issue May 19, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
Deserialize("[2]")


What is the expected output? What do you see instead?
List or Array with value 2

What version of the product are you using? On what operating system?
3.1.1.283

Please provide any additional information below.
Any expression starting with [ is considered a numeric expression. The problem 
is solved by providing a space as the first character

Original issue reported on code.google.com by 0Su...@gmail.com on 23 Aug 2013 at 6:49

@GoogleCodeExporter
Copy link
Author

I don't understand what the issue is.  Can you give more of a code sample?  
With what type are you constructing the serializer?  The 2 is a numeric 
expression, inside the [] it will be an array.

Original comment by elliott....@gmail.com on 24 Aug 2013 at 2:46

@GoogleCodeExporter
Copy link
Author

I feel the framework is treating any string starting with [ and not having a , 
as a numeric expression.  But I may be wrong, please look at the code samples 
below.

Serializer s = new Serializer(typeof(List<int>));
List<int> x = (List<int>)s.Deserialize("[2]"); //gives me a numeric expression 
error
List<int> x = (List<int>)s.Deserialize(" [2]"); //works as expected
Serializer s = new Serializer(typeof(List<String>));
List<String> x = (List<String>)s.Deserialize("[\"2\"]"); //gives me a numeric 
expression error
List<String> x = (List<String>)s.Deserialize(" [\"2\"]"); //works as expected

Somehow a simple fix of adding a " "(space) in front solves the problem.

Original comment by 0Su...@gmail.com on 24 Aug 2013 at 5:27

@GoogleCodeExporter
Copy link
Author

I'm unable to reproduce the issue.  It's working fine for me.  Are you in a 
different locale?  What framework and OS is this running on?

Original comment by elliott....@gmail.com on 28 Aug 2013 at 2:26

@GoogleCodeExporter
Copy link
Author

Original comment by elliott....@gmail.com on 28 Aug 2013 at 2:27

  • Added labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant