Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: Web Api Help page sample generation xml/json fails for classes inherited from lists [1501]

$
0
0
Ported from : https://aspnet.codeplex.com/workitem/10340

The fix is to change the following code in SampleGeneration/ObjectGenerator.cs

Replace

```
Type type = collectionType.IsGenericType ?
collectionType.GetGenericArguments()[0] :
typeof(object);
```

with

```
Type type;
if (collectionType.IsGenericType)
{
type = collectionType.GetGenericArguments()[0];
}
else
{
if (collectionType.BaseType != null && collectionType.BaseType.IsGenericType)
{
type = collectionType.BaseType.GetGenericArguments()[0];
}
else
{
type = typeof (object);
}
}
```

This fixes the sample xml/json generation for classes like

```
[CollectionDataContract(Name = "Addresses", Namespace = "")]
public class Addresses : List<Address>
{
}
```

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>