C# Test Unit DataRow max number of arguments reduced from MSTest 2.x to MSTest 3.x


I have unit tests with 30 parameters which where working last year. Now VS (17.6.0 Preview 2) doesn't compile and fires (I precise again this code was running well with all these arguments last year):

Erreur CS1729 'DataRowAttribute' ne contient pas de constructeur qui accepte des arguments 30 [...]
( CS1729 'DataRowAttribute' does not contain a constructor that takes 30 arguments )

These tests are used to check multiple values for a single record (and I have many records to check).

What can I do ? Thanks, Vincent

I'm using .Net Framework 6 & MSTest.TestFramework 3.0.2
As I can see in MS Test Framework, the constructor allow only 16 args now but I don't know why this regression and how handle it now.

What can I do ? 
Thanks, Vincent

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,354 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
331 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 2023-04-06T15:36:21.18+00:00

    I was able to start my old computer running VS 17.5.2, MS Test Framework is 2.2.8 and all is OK. DataRowAttribute has this constructor line 59 : public DataRowAttribute (object data1, params object[] moreData) This constructor has been removed. So in my new computer I roll back to 2.2.10 and it works. So the regression is from 2.x to 3.x on packages MSTest.TestFramework & MSTest.TestAdapter.

    Here is the answer from Microsoft :

    "This is a known breaking change. The previous approach (up to 2.2.10) was allowing an "infinite" number of arguments but was causing an issue when trying to pass an array of objects as 2nd argument (see for example Cannot provide 2 arrays to DataRow · Issue #1180 · microsoft/testfx (github.com)). Based on our data, 16 arguments was a good compromise and matches what is done by runtime for their API."