Skip to content

xunit warnings: Non-serializable data #30324

Closed

Description

@ViktorHofer

We are currently hiding thousands of warnings that indicate that our test data is not serializable. See aspnet/SignalR#1649 for more details.

Switching from xunit.console to dotnet test/vstest displays those warnings by default. I think we should at least investigate if the warnings are valid and consider fixing them.

Test branch with dotnet vstest for local validation: https://github.com/ViktorHofer/corefx/tree/DotNetTest
Related: dotnet/arcade#3333

Attaching the xunit log from System.Text.RegularExpressions.Tests: xunit-warnings.txt

cc @danmosemsft @safern

Activity

  1. ViktorHofer commented on Jul 21, 2019

    @ViktorHofer
    MemberAuthor

    XUnit unfortunately doesn't support theory member data serialization which means you need to implement IXunitSerializable to make that work: xunit/xunit#429 (comment)

    This is really unfortunate and I'm surprised that there isn't a solution for that yet. Maybe just switching off the diagnostics warnings (if possible) is easier... The downside, you won't be able to debug individual test cases in VS Test Explorer.

  2. ViktorHofer commented on Jul 21, 2019

    @ViktorHofer
    MemberAuthor
  3. ViktorHofer commented on Jul 21, 2019

    @ViktorHofer
    MemberAuthor

    What aspnet did was to just ignore those warnings... I'm not exactly sure how we should proceed here. This is a feature omission in xunit and should be fixed there but I don't think this will happen anytime soon. When switching to dotnet vstest those warnings will shop up and can only be turned off by also turning-off diagnostic messages which are needed for diagnosing long-running tests.

    cc @stephentoub for opinions

  4. stephentoub commented on Jul 21, 2019

    @stephentoub
    Member

    XUnit unfortunately doesn't support theory member data serialization which means you need to implement IXunitSerializable to make that work

    We use a bunch of types in theories that will never be serializable. I don't see xunit being able to address that fully, nor should we bend over backwards to make theory data serializable in order to have individual inputs show up in VS Test explorer; it's simply not worth it.

    When switching to dotnet vstest those warnings will shop up and can only be turned off by also turning-off diagnostic messages which are needed for diagnosing long-running tests.

    We can't suppress individual warning types? That's the feature I'd want from xunit if it doesn't already exist, ala being able to suppress C# compiler warning X but not Y.

  5. ViktorHofer commented on Jul 22, 2019

    @ViktorHofer
    MemberAuthor

    We can't suppress individual warning types?

    Unfortunately not. Currently it's either all diagnostics or none. I'm not sure if contributions are accepted at the moment given the staleness of the repo. The last official release was 9+ months ago.

  6. stephentoub commented on Jul 22, 2019

    @stephentoub
    Member

    Currently it's either all diagnostics or none

    @bradwilson, would xunit welcome a PR to address this in some way?

  7. bradwilson commented on Jul 23, 2019

    @bradwilson

    Yes, with a couple obvious caveats:

    1. We don't currently have message ID/categorization, so we would need to create that;
    2. We don't have any plans to ship any more v2 builds, which means the soonest you'd see this is when I'm able to ship a v3 (and when you'd be able/willing to move to it).
  8. transferred this issue fromdotnet/corefxon Feb 1, 2020
  9. added this to the Future milestone on Feb 1, 2020
  10. removed
    untriagedNew issue has not been triaged by the area owner
    on Jun 25, 2020
  11. dotnet-policy-service commented on Dec 26, 2024

    @dotnet-policy-service
    Contributor

    Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

    This process is part of our issue cleanup automation.

  12. dotnet-policy-service commented on Jan 9, 2025

    @dotnet-policy-service
    Contributor

    This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

  13. removed this from the Future milestone on Jan 9, 2025
  14. locked and limited conversation to collaborators on Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Metatest-bugProblem in test source code (most likely)

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions