Skip to content

Commit eab5003

Browse files
committed
Fixed mutex name
1 parent 31a3653 commit eab5003

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Exceptionless/Logging/FileExceptionlessLog.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,27 +312,27 @@ protected string GetLastLinesFromFile(int lines = 100) {
312312
/// Allows file based locking across processes
313313
/// </summary>
314314
private Mutex CreateSystemFileMutex(string fileNameOrPath) {
315+
string name = GetFileBasedMutexName(fileNameOrPath);
316+
315317
#if NET45
316318
var security = new MutexSecurity();
317319
var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);
318320
security.AddAccessRule(allowEveryoneRule);
319321

320-
string name = GetFileBasedMutexName(fileNameOrPath);
321-
322322
try {
323323
return new Mutex(false, name, out bool _, security);
324324
} catch (Exception ex) {
325325
if (ex is SecurityException || ex is UnauthorizedAccessException || ex is NotSupportedException || ex is NotImplementedException) {
326326
System.Diagnostics.Trace.WriteLine("Exceptionless: Error creating global mutex falling back to previous implementation: {0}", ex.ToString());
327-
return new Mutex(false, nameof(FileExceptionlessLog));
327+
return new Mutex(false, name);
328328
}
329329

330330
System.Diagnostics.Trace.WriteLine("Exceptionless: Error creating global mutex: {0}", ex.ToString());
331331
throw;
332332
}
333333
#else
334334
System.Diagnostics.Trace.WriteLine("Exceptionless: This platform does not support taking out a global mutex");
335-
return new Mutex(false, nameof(FileExceptionlessLog));
335+
return new Mutex(false, name);
336336
#endif
337337
}
338338

0 commit comments

Comments
 (0)