ServiceStack/ServiceStack.Text — Issue #68: No support of non-generic collections
Author: skarmats
Created: 2012-02-07 14:10:50+00:00
State: open

The serializer fails to deserialize to a target type of `StringCollection` (or `ArrayList`, etc)

I found the issue because a type had a property of type `StringCollection`but the minimal correct code that exposes this error is:
```
var s = @"[]";
var sc = s.FromJson();
```

A look at the code reveals that checks specific to generic types are performed after it has been determined that the type is not generic. That results in failure at `DeserializeSpecializedCollections`'s

```
public static ParseStringDelegate GetGenericEnumerableParseFn()
{
var enumerableInterface = typeof(T).GetTypeWithGenericInterfaceOf(typeof(IEnumerable<>));
var elementType = enumerableInterface.GetGenericArguments()[0]; // enumerableInterface is null
// ...
```

We arrive at that code from `JsReader`'s `public ParseStringDelegate GetParseFn()` at
```
// ...
if (isEnumerable)
{
var parseFn = DeserializeSpecializedCollections.Parse;
// ...
```

I guess there is no code yet that deals with these collections.
Maybe you would want to check of what type the indexer is to determine the correct parsing method.

I hope you will add support for these. I realize that the chances for that happening are pretty slim :-D

And thanks for the library :-)