-
Notifications
You must be signed in to change notification settings - Fork 253
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
Abstract class TestContext has different definitions for IDictionary properties between netframework and netstandard #474
Comments
@aakshayb : Acknowledging this to be a bug in framework. This seems like a simple fix. We would be happy to help you if you would like to take a shot at fixing this issue. |
I was about to open an issue related with this, but instead of the Properties prop, there are also a few methods in the TestContext class for netframework that are not available in netstandard version. In fact, already started working on migrating most of them to the netstandard implementation. @jayaranigarg if @aakshayb have not started to work on this issue yet, i'd like to grab it. So I can merge the work I've done in my local branch with the changes required to fix this issue :) Let me know if it is fine. [EDIT] |
@parrainc Please feel free to address this in your PR. I have no bandwidth to fix this here at this time. |
@parrainc : You are observing some methods missing from netstandard version of TestContext because they would make sense only when we implement [DeploymentItemAttribute] for netstandard projects. Since [DeploymentItemAttribute] is implemented for netframework, hence you will find more properties/methods there. You can go ahead and pick this up. We will plan to push PR #411 soon to unblock this change. Please feel free to reach out to us if you need any help on this. |
Fixed as part of this PR : #563 |
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
The text was updated successfully, but these errors were encountered: