Skip to content

suppressed test warnings #684

@justadreamer

Description

@justadreamer

These are MSTest 4.0 analyzer warnings that I suppressed because the projects have TreatWarningsAsErrors=true.

  ┌────────────┬─────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐                                                                       
  │    Code    │          Rule           │                                                      What it detects                                                      │                                                                       
  ├────────────┼─────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤                                                                       
  │ MSTEST0001 │ Parallelization setting │ Project doesn't explicitly enable/disable test parallelization via [Parallelize] or [DoNotParallelize] assembly attribute │                                                                       
  ├────────────┼─────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤                                                                       
  │ MSTEST0017 │ Swapped arguments       │ Assert.AreEqual(actual, expected) instead of correct order Assert.AreEqual(expected, actual)                              │                                                                       
  ├────────────┼─────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤                                                                       
  │ MSTEST0037 │ Use specific asserts    │ Using generic asserts like Assert.IsTrue(list.Count == 5) instead of Assert.HasCount(list, 5)                             │                                                                       
  ├────────────┼─────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤                                                                       
  │ MSTEST0044 │ Obsolete attribute      │ Using [DataTestMethod] which is now obsolete - should use [TestMethod] instead                                            │                                                                       
  ├────────────┼─────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤                                                                       
  │ MSTEST0052 │ DynamicData argument    │ Using explicit DynamicDataSourceType argument that's no longer needed (auto-detected)                                     │                                                                       
  └────────────┴─────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

These analyzers come with MSTest.Analyzers (transitive dependency of MSTest 4.0). In pipeline-dotnet they're just warnings, but in device-detection-dotnet they become errors due to TreatWarningsAsErrors.

Proper Fix

The proper fix would be to update the test code to follow the new patterns, but that requires more extensive changes. Suppressing them allows the build to succeed while keeping the existing test behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions