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

The IDE cannot copy the mongod.exe to the output dir #24

Closed
marcosdeassis opened this issue Mar 5, 2023 · 2 comments
Closed

The IDE cannot copy the mongod.exe to the output dir #24

marcosdeassis opened this issue Mar 5, 2023 · 2 comments

Comments

@marcosdeassis
Copy link

Hi,

I'm facing an issue that might be related to the following behavior mentioned in the issue: "Windows Defender Firewall" want to block communication of testhost.exe

  • EphemeralMongo also uses .NET Process class to start mongod.exe from your project output directory.

If I run the integration test end to end for the first time, it works perfectly. But if force the execution to end in the middle of the test (Shift + F5), the mongod.exe is left running. Then if I make any change in the test code and try to run the test again, the IDE can't copy the mongod.exe file to the output directory, so I can't run the tests.

image

This is happening because the mongod process is still running.
image

image

@asimmon
Copy link
Owner

asimmon commented Mar 9, 2023

Hi @marcosdeassis, I don't think it is related to Windows Defender Firewall, it's really just that the process is still running and at compilation time MSBuild tries to overwrite the file.

It might be because I used CopyToOutputDirectory = Always instead of PreserveNewest. I'll make some tests later to see if this behavior is the root cause of your issue.

In the meantime, I just released 1.1.0 which contains an experimental flag MongoRunnerOptions.KillMongoProcessesWhenCurrentProcessExits that makes sure any mongo process gets killed if the running process (in your case, the IDE test host) is prematurely killed. It only works on Windows and modern .NET (.NET Core and later).

I think it should solve your issue. The pull request behind this experimental flag is here.

@marcosdeassis
Copy link
Author

marcosdeassis commented Mar 10, 2023

Hi @asimmon

Yes, you are correct.

The experimental flag is working perfectly so far.

Thank you for your time implementing the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants