-
Notifications
You must be signed in to change notification settings - Fork 335
Problems with null in DataRow #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I just ran into this problem again today working on a unit test where a DataRow contains a int? column and I wanted to try null. I can't be the only one bumping into this. In this case, I can't type (int?)null as a value in a DataRow - I get "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type". So now I probably need to change the type of value in the test method signature to "object" and cast it to (int?) - ugly. And then I still must use (object)null in the DataRow to avoid the "Error in executing test" message. |
@jmagaram Here is a more convenient workaround until this gets fixed:
Make that
Hope that gets rid of most of the inconvenience. This should be fixed in an up-coming update. |
This has been fixed in MSTest.TestFramework (1.1.14) and MSTest.TestAdapter (1.1.14). Release notes are here. Thanks for reporting this. |
Description
Occasionally my unit tests fail to run and display a very cryptic message in the output. I've narrowed the problem down to using null values inside a DataRow. The error message is completely unhelpful and the fix is unexpected. I can't believe this is by-design.
The error message is
Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.
The "fix" is to replace the last row with...
When I do this, Visual Studio recommends removing the unnecessary cast. I've tried labeling the datarow parameters but can't seem to make this work.
Steps to reproduce
Try running the unit test above in the RC version of Visual Studio 2017.
Expected behavior
I expect the test to run and give me correct results. Or a much more helpful error message.
The text was updated successfully, but these errors were encountered: