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

Separate assembly for InternalTrace and other common classes #1608

Closed
CharliePoole opened this issue Jan 20, 2025 · 3 comments
Closed

Separate assembly for InternalTrace and other common classes #1608

CharliePoole opened this issue Jan 20, 2025 · 3 comments

Comments

@CharliePoole
Copy link
Member

CharliePoole commented Jan 20, 2025

InternalTrace is implemented in nunit.engine.core, which we plan to eliminate. We would then need to replicate it in nunit.engine, nunit.agent.core and NUnit.Extensibility. What's more, the framework has its own copy of InternalTrace.

In addition, a number of other useful classes are currently shared across projects by links to the source code. This is slightly messy and can only get worse.

I propose to create a single NUnit.InternalTrace nunit.common assembly to be referenced by each project that needs to have it. In fact, I'll be re-creating it, since we had one in the past.

This is an experimental issue - what we used to call a "spike." If it seems viable, I'll continue it. If not, I'll try to abandon it quickly, with minimal time invested. UPDATE: The strikeout above definitely show the experimental nature of this issue. :-)

Since I have already implented InternalTrace centrally for TestCentric I'll start by stealing that code. Of course, nunit-console is organized quite differently to TestCentric, with multiple projects under one solution, so changes will probably be needed.

I'll report back here when I either remove this issue or remove the experimental label.

@nunit/engine-team At this point, it would be good to put in your suggestions, including whether or not you think this is a good idea. :-)

@manfred-brands
Copy link
Member

I am normally for sharing coding over copy & digress over time.

So a separate nunit.common repository with one or more nuget packages is fine by me.
There is also the Guard class.

The downside is another dependency on a another repository.
As it is used by multiple projects, we need to make sure it stay compatible.
But if it is for infrequent changing code, that should be fine.

@CharliePoole
Copy link
Member Author

@manfred-brands

At least initially, I don't think this assembly would be a separate project or package. I'd keep it in the nunit-console solution. Pluggable agents would get it bundled with the new nunit-agent-core package. That package can be published right out of the solution, as we now do for the engine library.

That could change, of course, but only if we see the need for more packages arise. In this case, I guess that would be the point where some other project, e.g. NUnitLite, wanted to use it.

@CharliePoole
Copy link
Member Author

@manfred-brands

Yes, an nunit.common assembly which contains both the internal trace stuff as well as Guard, CallerExpressionArgumentExpressionAttribute and possibly other things does make sense. I'll update the description.

@CharliePoole CharliePoole changed the title Separate assembly for InternalTrace Separate assembly for InternalTrace and other common classes Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants