Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed LogManager GC test on Mono.

  • Loading branch information...
commit a4d93e3b8d13471c9525db7013dce4f907f82e45 1 parent 2777b71
Jarek Kowalski authored

Showing 1 changed file with 9 additions and 5 deletions. Show diff stats Hide diff stats

  1. +9 5 tests/NLog.UnitTests/LogManagerTests.cs
14 tests/NLog.UnitTests/LogManagerTests.cs
@@ -75,11 +75,16 @@ public void GarbageCollectionTest()
75 75 Assert.AreSame(loggerA1, loggerA2);
76 76 }
77 77
  78 + static WeakReference GetWeakReferenceToTemporaryLogger()
  79 + {
  80 + string uniqueLoggerName = Guid.NewGuid ().ToString();
  81 + return new WeakReference (LogManager.GetLogger(uniqueLoggerName));
  82 + }
  83 +
78 84 [Test]
79 85 public void GarbageCollection2Test()
80 86 {
81   - string uniqueLoggerName = Guid.NewGuid().ToString();
82   - WeakReference wr = new WeakReference(LogManager.GetLogger(uniqueLoggerName));
  87 + WeakReference wr = GetWeakReferenceToTemporaryLogger();
83 88
84 89 // nobody's holding a reference to this Logger anymore, so GC.Collect(2) should free it
85 90 GC.Collect();
@@ -165,11 +170,10 @@ private void OnConfigReloaded(object sender, LoggingConfigurationReloadedEventAr
165 170 _reloadCounter++;
166 171 }
167 172
168   - private bool IsMacOsX()
  173 + private bool IsMacOsX ()
169 174 {
170 175 #if MONO
171   - // just an approximation, to detect Mac OS X
172   - if (Environment.OSVersion.Platform == PlatformID.Unix && Environment.OSVersion.Version.Major == 10)
  176 + if (Directory.Exists("/Library/Frameworks/Mono.framework/"))
173 177 {
174 178 return true;
175 179 }

0 comments on commit a4d93e3

Please sign in to comment.
Something went wrong with that request. Please try again.