You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Abstract class TestContext has different definitions for IDictionary properties between netframework and netstandard #474
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
changed the title [-]Abstract class TestContext has different implementations for IDictionary properties between netframework and netstandard[/-][+]Abstract class TestContext has different definitions for IDictionary properties between netframework and netstandard[/+]on Aug 7, 2018
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.
Jayarani garg (@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]
First, this PR #411 should be merged into master, so we get a newer version of the netstandard, because the one used (1.0) is missing some functionalities. I partially fixed an issue #394 but I'm waiting for the PR to be merged :)
Carlos Parra (@parrainc) Please feel free to address this in your PR. I have no bandwidth to fix this here at this time.
I worked around this problem in my own code base.
Thanks
Carlos Parra (@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.
Activity
[-]Abstract class TestContext has different implementations for IDictionary properties between netframework and netstandard[/-][+]Abstract class TestContext has different definitions for IDictionary properties between netframework and netstandard[/+]jayaranigarg commentedon Aug 30, 2018
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.
parrainc commentedon Aug 30, 2018
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.
Jayarani garg (@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]
First, this PR #411 should be merged into master, so we get a newer version of the netstandard, because the one used (1.0) is missing some functionalities. I partially fixed an issue #394 but I'm waiting for the PR to be merged :)
passionatedevelopermsft commentedon Aug 30, 2018
Carlos Parra (@parrainc) Please feel free to address this in your PR. I have no bandwidth to fix this here at this time.
I worked around this problem in my own code base.
Thanks
jayaranigarg commentedon Aug 31, 2018
Carlos Parra (@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.
jayaranigarg commentedon Apr 3, 2019
Fixed as part of this PR : #563