Skip to content

Data contract serialization for System.Type #6005

@Youssef1313

Description

@Youssef1313

Today, System.Type isn't serializable via data contract serialization. Thus, any parameterized tests making use of System.Type will be forced to be folded. It will throw this exception:

System.Runtime.Serialization.InvalidDataContractException: 'Type 'System.RuntimeType' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.'

We catch the exception in TryUnfoldITestDataSources and then we don't "unfold" during discovery.

This is originally reported in https://developercommunity.visualstudio.com/t/C-TestExplorer-does-not-show-children-f/10936786

Metadata

Metadata

Assignees

Labels

Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Area: Parameterized tests

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions