Skip to content
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

.NET Core agents don't set AppDomain.CurrentDomain.BaseDirectory as expected #76

Closed
CharliePoole opened this issue Feb 11, 2023 · 3 comments
Assignees
Labels
Bug Something isn't working as expected. Not a Bug Closed. This is not a bug. May be usage problem or by design.

Comments

@CharliePoole
Copy link
Contributor

CharliePoole commented Feb 11, 2023

This issue reflects issue nunit/nunit-console#1313. We anticipate that the same problem exists in the TestCentric engine since it contains similar code to the NUnit engine and runs .NET Core tests in the agent's primary AppDomain.

As I commented on the nunit issue, "NUnit traditionally ran tests in a separate AppDomain, which it created. The .NET Framework agents still do that. You can find the key code in the DomainManager class. That class is only built for .NET Framework. The .NET Core agents all run tests in the primary AppDomain."

The TestCentric agent is currently set up the same way, so I believe the same issue applies. However, it will require confirmation before proceeding.

@CharliePoole CharliePoole added Bug Something isn't working as expected. Needs Confirmation Bug that needs confirmation before we work on it High Priority High priority issue labels Feb 11, 2023
@CharliePoole CharliePoole self-assigned this Feb 11, 2023
@CharliePoole CharliePoole removed the Needs Confirmation Bug that needs confirmation before we work on it label Feb 11, 2023
@CharliePoole
Copy link
Contributor Author

As expected, this problem is also present in the TestCentric engine.

@CharliePoole
Copy link
Contributor Author

I've done a bit of reading and I'm now doubtful that behavior I confirmed is actually a bug, so I'm flagging this as needing discussion before any more is done. My reasoning is as follows..

  1. AppDomains are somewhat minimally supported in .NET Core. In particular, they cannot be created.
  2. As a result, all code runs in the primary AppDomain of the process hosting it.
  3. Consequently, no test assembly being executed by a test runner should expect the ApplicationBase to be anything other than the primary AppDomain.
  4. In addition, any assembly referenced by the test assembly will also be a .NET Core or Standard assembly, so the same limitations apply to it.

That said, there could be use cases I don't know about that violate these assumptions. If so, I'd like to hear about them.

@CharliePoole CharliePoole added the Needs Discussion We should discuss this with team and users before proceeding label Feb 12, 2023
@CharliePoole
Copy link
Contributor Author

There has been no further comment on this for more than two months. Closing.

@CharliePoole CharliePoole added Not a Bug Closed. This is not a bug. May be usage problem or by design. and removed High Priority High priority issue Needs Discussion We should discuss this with team and users before proceeding labels Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working as expected. Not a Bug Closed. This is not a bug. May be usage problem or by design.
Projects
None yet
Development

No branches or pull requests

1 participant