Daily Usage Issues

nCrunchTemp_*csproj not cleaned up

Started by nikize on 20 views

Hi, being left with several of these files.
* How can I investigate why they are not deleted after use?
* Cleanup seems to itself trigger a regen and file recreation, maybe my way of trying cleanup but would still be nice to prevent regen on clean
* Any setting to clean up all these files if they happen to be leftover? I think that should be the default.
Hi, thanks for sharing this issue.

NCrunch creates these files temporarily when it loads your projects. If things are functioning normally, they should only exist for a few seconds at most.

There are known circumstances where the files can be left behind if the engine process is interrupted during project load (i.e. forcefully terminated etc). This is considered to be rare. If you're getting a mass accumulation of these files, it's worth investigating. How often do you need to clean them up? Are they left behind every time you start the engine?
Thanks, totally understand how they should work.

I shouldn't say that I see them in every solution I'm working with, but at least feels like several of them.
It becomes annoying when for example searching for things in csproj files in given directory, and there is mostly
nCrunchTemp_
files being listed, I then go to delete them, and they are "back right after"*
In some cases I have seen multiple files for the same project
* I usually run
rm -Recurse **/nCrunchTemp_*
but after posting I tried to verify and it turns out the files was not deleted at all.
Switching to
ls -Recurse ncrunchtemp_* | foreach {rm -Force $_ }


What worries me is the buildup of several files for the same project with legacy content. I understand the termination, several of the projects fails to build in one way or other, but in that case I assume they should still be cleaned up.
But nCrunch does sometimes get terminated since things just hangs, and a kill/restart is needed. But then I think it would be good if it is cleaned up on next run.
Actual suggestion scan thru and if there is any files leftover that is older than 2 minutes then they should probably be purged?

Trying to actually verify this, - so far no files left over, so maybe it was just my clean failing. so at least not left behind on every engine run.

But are there any logs for when these files are created and deleted and what might have failed in-between?
Thanks, yes I agree this is an annoying problem. It showed up a lot in the early days of the product, and it was maddening.

The cleanup of the files is within a try-finally block, so their deletion failure won't be because of a normal exception. NCrunch does keep logs but they are held in memory in the session, tend to be large and are hard to recover in a way that aligns with finding the files late after the problem has happened. You can examine the NCrunch logs by using the 'Submit Bug Report' option in the NCrunch menu, then clicking the Save to disk option.

I will most likely implement something to delete these files later when found. This does feel like we're working around something else though, it and seems prudent to understand why this is happening so frequently for you.

Do you have anything that might interfere with the engine process on your machine? A virus scanner perhaps? Anything that might forcefully terminate it? Do you get any weird errors when using NCrunch in general? Instability?
Agreed, if I can find a way to reproduce that is of course best, and I think that my main issue was that my manual deletions failed. Thinking more about it, for now it is fine as it is, and we can instead focus on trying to figure out why the expected behavior fails.

Scenario where I see this is in a VM that sometimes get high disk latency and maybe memory pressure, so in theory it could be an outofmemory that fails and then the cleanup is of course not possible.
The disk latency could potentially increase chances of a lock on files so they can not be deleted, let's say multiple instances of VS is running working against the same projects (not the case for the most projects I see these files on, but just a theory on how to reproduce something similar) Assume that delete fails due to file lock, will that be seen in the log, and can it be made easily visible in the UI somehow, or even run some application or similar if it happens? (otherwise i probably miss it)

Also I do a lot out of VS edits of csproj and Directory.Build.props that triggers VS to want to reload projects, If that happens are the nCrunch threads maybe canceled and finalizers not running?

I have a lot of issues, but I'm chucking it of mostly to these solutions not being great in the way nCrunch runs things, as in long running tests and tests that fail on concurrency, many of the projects don't even build. not the fault of nCrunch.
For AV there is only Defender.

For now ignore this until I can find any lead on what is happening

Post a reply

Log in to reply.