Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

File access through different .NET application domain



You mention in a number of places that only one process can access the log file at the same time. I guess that you mean a .NET process and not a Windows process. I tried to write to the same log file through different .NET application domains that were hosted in the same Windows process and i still get the “no access” error; so, i reverted to using the Router.

Is this correct?



Yes, this is correct. Actually, you can’t even open the same log file twice from within the same thread (with two separate SmartInspect instances; of course you can share a SmartInspect object between threads to log to the same log file). It’s just that you can open/create a log file only in case there’s no other process/thread/appdomain that already has this log file open. Our explanation that only one process can access the log file at the same time is perhaps a bit misleading/lacking in this regard.

The best option for writing to a shared log file from multiple processes or application domains is indeed the router which automatically synchronizes the access to the log file.