dotnet / dotnet/dotnet-api-docs
Assigning things into Data throws if the key or value isn't Serializable. this should be documented.
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
The sourcecode of ListDictionaryInternal is explicit:
```cs
if (key == null)
{
throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
}
if (!key.GetType().IsSerializable)
{
throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "key");
}
if (value != null && !value.GetType().IsSerializable)
{
throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "value");
}
```
i think this should at least be mentioned in the documentation, e.g. somewhere here:
https://learn.microsoft.com/en-us/dotnet/api/system.exception.data?view=netframework-4.8#system-exception-data
Contributor guide
Assessment
This issue has not been assessed yet.