-
Notifications
You must be signed in to change notification settings - Fork 106
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
Current directory C:\WINDOWS\system32 again #1026
Comments
Thanks @janid1967 for reporting! What settings do you use? |
I use just a simple .runsettings, setting one env var:
|
Tried WorkingDirectory with no effect:
|
I am not able to reproduce the error. The error message indicates it is in the testhost. If you can upload a small repro it would be easier to help out :-) |
@CharliePoole Just had a screen-sharing session with @janid1967 , using the 4.2.1 adapter with the 3.15.2 engine, and it seems that the fault happens down in the Engine, see the following screenshot: We set the InternalTraceLevel to Off, but it did not have any effect. This does not happen with the 4.2.1 which uses the 3.13 engine. |
Do you set the engine WorkDirectory? Note that this property is not the same as the process current directory, but is the specific directory where you want test results and logs to go. It defaults to the current directory but that's only useful when using the console runner from the command-line. When I get an instance of the engine, I generally always set the TraceLevel and WorkDirectory properties. |
@janid1967 My comment was in reference to what I believe the NUnit3 Adapter code should do. If the code (which I haven't examined) is using the WorkDirectory property from RunSettings to set current directory, that won't have any effect on where logs are saved. |
The adapter's WorkDirectory property is sent to the engine as part of the package properties. package.Settings[PackageSettings.WorkDirectory] = workDir; And likewise: package.Settings[PackageSettings.InternalTraceLevel] = Settings.InternalTraceLevel; |
This is what the console runner does...
As you see, it allows the engine to deal with a non-specified work directory by not providing a setting at all. The engine will then use the current directory. In fact, this would give an error if the user were to run the console from a write-protected directory but this has never come up as an issue. So the runner is not changing the current directory, it should not be necessary to provide an option at all. However, my vague memory is that the IDE at least does take control of the current directory, which is why some setting is necessary. Can you confirm that the test package setting is correct at the point where you use it to get a runner both for discovery and execution? If so, then I think this may be a bug in 3.15.2. If there's a bug, it will go into 3.16, of course. I'll also have to figure out a way to test it without using the adapter. |
VS fires up a testhost.exe. This is the equivalent of the runner, but that resides (at least for a net 6.0 project) in the binary output folder, like:
So it looks like the setting is being passed down correctly, but also that the file is being created regardless of its setting. In this case I haven't set any workdirectoy, so it is just the default. What is real strange with @janid1967 's case is that regardless of whether he sets the workdirectory or not, the engine believes the current directory is that WinDir. Now, his projects uses the old VS project system (and package.configs) and targets net4.7.2, and there might be something strange going on there. |
The empty log files are this issue: nunit/nunit-console#1178 It will be closed in 3.16. We talked about this before. This is the issue that was fixed for 3.15.2, but somehow didn't get into the packages, so I did it over for 3.16. One note: if you pass a relative directory to the engine, it is combined with the current directory. That may be what happens in @janid1967's case. |
Ok, good to hear it is known. When is 3.16 ETA ? I'll need to put out an updated adapter with that one directly after that. The path he passed in was absolute If I do the same in my project here, the tracelogs go correctly to c:\tmp. I've tried to fire up some older projects here, but they are repro issues and got issues. Further, the old csproj system doesn't handle the switching of nuget versions very well. @janid1967 Can you just create two very simple test programs using your old csproj system, one with 4.2.1 and one with 4.3.0, and upload? Use the same runsettings file in both. If they show the same behaviour it is some kind of bug, but if they behave correctly, there might be some older parts hanging in there in your project, remains from earlier versions or something. |
@janid1967 Also, please check that the vstest cache is either not present or empty, that has been a really annoying issue earlier, both for NUNit and XUnit. Also, Unload your test project and check the project XML, ensure that there is no mess like this in that file: |
@OsirisTerje Sometime in November - as I wrote when I announced my resignation. The main thing holding it up is the .NET 7.0 final release. Since nobody is taking over from me, it seems like a good idea to wait for that. However, if it's not out in November then I'll release with support for RC-2. From another discussion, I realize you don't actually need that support, so if the dev build worked for you, we could just pin it. |
There was no VisualStudioTestExplorerExtensions folder under my C:\Users\jdalsb\AppData\Local\Temp After migrated my test project from having PackageReference to now having packages.config, my csproj look like: |
I created a minimum solution, first I added one project using NuGets Then I added project 2, using NuGets This is without any .runsettings |
Released here https://www.nuget.org/packages/NUnit3TestAdapter/4.3.1 |
After upgrading from nunit3testadapter 3.17.0 to 4.3.0 I start to get this in Output->Test:
"NUnit Adapter 4.3.0.0: Test execution started
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Access to the path 'C:\WINDOWS\system32\InternalTrace.31528.log' is denied. Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges."
(I've read #637 which should solve what I now experience)
Please assist
Installed Nuget NUnit 3.13.3 and NUnit3TestAdapter 4.3.0
Visual Studio
Target framework .NET Framework 4.72
The text was updated successfully, but these errors were encountered: