Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit cfa3700

Browse files
committed
more changes
1 parent 994c831 commit cfa3700

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Microsoft.AspNet.Mvc.Core/SessionStateTempDataProvider.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ internal void EnsureObjectCanBeSerialized(IDictionary<string, object> values)
100100
{
101101
itemType = itemType.GetElementType();
102102
}
103-
else if (TypeHelper.IsCollectionType(itemType))
103+
else if (itemType.IsGenericType)
104104
{
105-
actualTypes = itemType.GetGenericArguments();
105+
if (itemType.ExtractGenericInterface(typeof(IList<>)) != null ||
106+
itemType.ExtractGenericInterface(typeof(IDictionary<,>)) != null)
107+
{
108+
actualTypes = itemType.GetGenericArguments();
109+
}
106110
}
107111

108112
actualTypes = actualTypes ?? new Type[] { itemType };

test/Microsoft.AspNet.Mvc.Core.Test/SessionStateTempDataProviderTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public static TheoryData<string, object> ValidTypes
130130
{ "SimpleDict", new Dictionary<string, int>() },
131131
{ "Uri", new Uri("http://Foo") },
132132
{ "Guid", Guid.NewGuid() },
133+
{ "SimpleList", new List<string> { "foo", "bar" } }
133134
};
134135
}
135136
}

0 commit comments

Comments
 (0)