-
-
Notifications
You must be signed in to change notification settings - Fork 180
Correctly handle the existence of TestContext in base class
#1489
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
Conversation
|
I don't think this is a safe change to do? It suppresses the compiler warning, but now there may be two different properties, one that has the necessary machinery to hook the setter, and one that doesn't. I think this could lead to Verify not seeing the correct TestContext if anything we're to interact with the base class? |
|
@MattKotsenas There are two different properties, yes. One in base, and we shadow it in source-generated code generated by Verify. While shadowing is generally discouraged, I don't see much of an issue in that in this specific case. The property generated by The only scenario where both properties can get out-of-sync is if something is setting the base property. But as |
|
I'll leave it to @SimonCropp if he wants to accept the change as project owner. I'd still suggest against it, as though @Youssef1313 is correct about how things should be, Verify will be at the mercy of all base classes behaving properly, and this change removes the only warning we currently have, which will make debugging these types of issues more difficult. Instead I'd suggest either of the other two threads listed in the bug: fixing the Playwright tests as a targeted fix, or introducing the AsyncLocal to MSTest to sidestep the issue entirely. However, if there's something I'm missing, please let me know! |
|
For MSTest, I'm definitely interested in introducing a Another alternative for Playwright is to rely on constructor injection, but that forces all test classes to have a constructor injecting the TestContext to base. |
|
@Youssef1313 , understood that the .Current property will likely take time. Isn't microsoft/playwright-dotnet#3210 another alternative for Playwright that's non-breaking and allows this scenario? |
why? from my, perhaps naive, perspective, this should be fairly trivial thing to add? could it perhaps be added faster as a |
Well, it's trivial thing to add and we already have the API internal. But we are already not very comfortable with So far, we don't yet have any concrete design for the specialized Another thing is that I want to allow some time (and do more manual testing) around the propagation of |
|
closing this in fav of this microsoft/playwright-dotnet#3210 |
Fixes #1482