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

--domain=None does not work #1741

Closed
rprouse opened this issue Aug 14, 2016 · 8 comments
Closed

--domain=None does not work #1741

rprouse opened this issue Aug 14, 2016 · 8 comments

Comments

@rprouse
Copy link
Member

rprouse commented Aug 14, 2016

Tested in 3.4.1, should retest in master.

Run tests with the command line,

--domain=None or --inprocess --domain=None fails with Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified. I am running using the installed console from the test project bin directory.

Ideally, the console is in a different directory and doesn't have a copy of the framework sitting in the build directory. Our build output isn't the best test for this. I tested with an installed version of the console.

@CharliePoole
Copy link
Contributor

Domain=None has only ever worked if the test assembly and all nunit assemblies are in the same directory. I talked about removing it but there are a few odd uses for testing code that can only ever run in a primary AppDomain.

@jcansdale
Copy link

I use it: 😉
https://github.com/nunit/nunit3-tdnet-adapter/blob/master/src/NUnitTDNet.Adapter/EngineTestRunner.cs#L51

The NUnit assemblies will loaded into the LoadFrom context (rather than being in the same directory).

@CharliePoole
Copy link
Contributor

@jcansdale Unless one of our contributors slipped something past us :-) NUnit doesn't use LoadFrom except in the presence of a special package setting that is not accessible to users. Is that what you are using? If you are, it's a little risky, since it's not a published interface. We can look into this more closely if you like.

@rprouse Is domain=None failing in cases where you have used it successfully before?

@jcansdale
Copy link

It's only when I create a TestPackage object directly that I use the AddSetting("DomainUsage", "None") setting. It's my code that resolves the NUnit assemblies and loads them using LoadFrom. I don't actually use this setting with the NUnit console (which I realize this issue is about). Sorry. 😄

@CharliePoole
Copy link
Contributor

So, what I imagine happens is that NUnit attempts to load the assemblies and finds the copy you already loaded - I'm slightly surprised at that, since they are in the LoadFrom context.

There is actually a "secret" setting that will cause NUnit to create an AssemblyResolver that will do a LoadFrom - search for ImageRequiresDefaultAppDomainResolver.

@CharliePoole
Copy link
Contributor

@rprouse I agree there's nothing critical about this one. I was surprised you could run domain=none, but I realized it will work if you are in the nunit project and running in the bin directory. We should really address what this setting does and what we want it to do. The defects can either be fixed or documented as far as I'm concerned.

@jcansdale's use is actually much safer than use from the command-line. He specifies it in the package because he has already created the appdomain and doesn't want a new one.

@rprouse
Copy link
Member Author

rprouse commented Aug 15, 2016

I don't think we can do much with domain=None to fix it. There are so many ways that it could go wrong with multiple assemblies referencing different versions of the same assembly, etc. We could document it, but if we do, we should probably add a warning to the command line help too.

@CharliePoole
Copy link
Contributor

Issue moved to nunit/nunit-console #28 via ZenHub

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

4 participants