Skip to content

Abstract class TestContext has different definitions for IDictionary properties between netframework and netstandard #474

Description

@passionatedevelopermsft

Description

The abstract class TestContext is not same between netframework and netstandard. This causes TypeLoaderReflection exceptions when an attempt is made to load an implementation of TestContext created targeting a different platform than the consuming service. More details in steps to reproduce -

Steps to reproduce

Create a dotnetstandard library that depends on MsTest.TestFramework. In here, create an implementation of TestContext, lets call it TestContextImpl . You will end up overriding IDictionary<string, object>. Create a nuget package for this library.

Create a new aspnet core application targeting netframework 4.6, add nuget dependency on the library created above. Attempt to hit sample controller and it will trigger MVC to load all types, including TestContextImpl which will blow up with a TypeLoadReflectionException because the abstract class definition is used from netframework 46 which does not know about IDictionary<string, object> properties but instead knows about IDictionary properties.

Expected behavior

No TypeLoadReflectionException should happen and the abstract class should be consistent across platform

Actual behavior

Unable to load an implementation of TestContext because abstract IDictionary was not available in the implementation based on new TestContext

Environment

Windows 10, MSTest version 1.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedUp for grabs; can be claimed by commenting.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions