Reputation: 10959
When I do this:
using (Mutex MyMutex = new Mutex(true, Environment.CurrentDirectory))
{
}
A System.IO.DirectoryNotFoundException
is thrown. I see other questions on here addressing how to avoid that which is to replace \
with something else like .
or -
, but I want to know why it's doing that. Why is it try to resolve the mutex name as a path? It doesn't try to resolve asdf
as a path. What is going on here?
Upvotes: 2
Views: 136
Reputation: 16575
The Mutex is created within a store called the ObjectDirectory, all Mutex keys are actually paths within this store. The fact that you've given an absolute path, means the implementation will try to resolve that. Take a read of the win32 document here
http://msdn.microsoft.com/en-gb/library/windows/desktop/ms682411(v=vs.85).aspx
Upvotes: 1