This is a good suggestion. I have previously had Avast move executables under my nose when I started debugging. But two things: First of all I’ve never seen it happen with a regular file, just executables. Second this VM doesn’t have it, just Windows Defender (it is a little bit less aggressive with such things), and there’s nothing in quarantine history there.
Could still be something else, but I have no idea what it could be. It is a minimal environment, used only for development so there’s not much running on it.
The files were in AppData/Local/Temp. That’s where they end up.
There is no config file there. And I’ve checked Environment variables in 3 different ways, and I don’t know how to confirm it more. It’s almost the same as when I couldn’t set it to in-memory the first time. But then it worked with using Environment.SetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", "true");
This time I’ve been trying setting it back to “false” and then use Environment.GetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE");
to check if it is set. And it is “false”, but it has still used in memory storage.
So, turns out when I pass in the bool variable.ToString(), it was setting it to “False”. Shouldn’t matter at all, but I tried adding .ToLowerInvariant(); as to make it “false”. Just tweaking whatever I see tweakable.
Also, there are 3 overloads, and so I made sure to set them all, i.e.:
Environment.SetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", $"{inMem}".ToLowerInvariant(), EnvironmentVariableTarget.Machine);
Environment.SetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", $"{inMem}".ToLowerInvariant(), EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", $"{inMem}".ToLowerInvariant(), EnvironmentVariableTarget.User);
Then, controlling the value of them all:
var env_0 = Environment.GetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", EnvironmentVariableTarget.Machine);
var env_1 = Environment.GetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", EnvironmentVariableTarget.Process);
var env_2 = Environment.GetEnvironmentVariable("SAFE_MOCK_IN_MEMORY_STORAGE", EnvironmentVariableTarget.User);
And they are all “false”.
Additionally in cmd prompt, enter SET, and it gives this:
And the third and last check is via Control Panel\System and Security\System => Advanced system settings => Environment variables
And it shows the same.
So, this is what led me to think that there is maybe something cached somewhere? Well, I have no other guesses.
I did all of this the other day, made sure to check it one more time now before posting this. Same results.