diff --git a/Emby.Dlna/ContentDirectory/ContentDirectory.cs b/Emby.Dlna/ContentDirectory/ContentDirectory.cs index d547ad8d43..fbd7090104 100644 --- a/Emby.Dlna/ContentDirectory/ContentDirectory.cs +++ b/Emby.Dlna/ContentDirectory/ContentDirectory.cs @@ -17,7 +17,7 @@ using MediaBrowser.Model.Xml; namespace Emby.Dlna.ContentDirectory { - public class ContentDirectory : BaseService, IContentDirectory, IDisposable + public class ContentDirectory : BaseService, IContentDirectory { private readonly ILibraryManager _libraryManager; private readonly IImageProcessor _imageProcessor; @@ -143,10 +143,5 @@ namespace Emby.Dlna.ContentDirectory return null; } - - public void Dispose() - { - - } } } diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index 4ff413b9bd..bdc523c8bc 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -596,6 +596,7 @@ namespace Emby.Dlna public void Dispose() { + GC.SuppressFinalize(this); } } } \ No newline at end of file diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index a6facab7d7..3dd36a27bc 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -394,6 +394,7 @@ namespace Emby.Dlna.Main _communicationsServer.Dispose(); _communicationsServer = null; } + GC.SuppressFinalize(this); } public void DisposeDlnaServer() diff --git a/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs b/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs index 365354efd9..4ed74a6844 100644 --- a/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs +++ b/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs @@ -9,7 +9,7 @@ using MediaBrowser.Model.Xml; namespace Emby.Dlna.MediaReceiverRegistrar { - public class MediaReceiverRegistrar : BaseService, IMediaReceiverRegistrar, IDisposable + public class MediaReceiverRegistrar : BaseService, IMediaReceiverRegistrar { private readonly IServerConfigurationManager _config; protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory; @@ -33,10 +33,5 @@ namespace Emby.Dlna.MediaReceiverRegistrar Logger, XmlReaderSettingsFactory) .ProcessControlRequest(request); } - - public void Dispose() - { - - } } } diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index 213e7367f0..5a63be3046 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -1105,6 +1105,7 @@ namespace Emby.Dlna.PlayTo _disposed = true; DisposeTimer(); + GC.SuppressFinalize(this); } } diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index f1b18a5433..e8d7c91272 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -685,6 +685,7 @@ namespace Emby.Dlna.PlayTo _device.OnDeviceUnavailable = null; _device.Dispose(); + GC.SuppressFinalize(this); } } diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index e29ef78a88..6f2f5f24b3 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -225,6 +225,7 @@ namespace Emby.Dlna.PlayTo { _disposed = true; _deviceDiscovery.DeviceDiscovered -= _deviceDiscovery_DeviceDiscovered; + GC.SuppressFinalize(this); } } } diff --git a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs index 9abf85e70f..2c40bf570c 100644 --- a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs +++ b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs @@ -12,7 +12,7 @@ using MediaBrowser.Model.System; namespace Emby.Drawing.ImageMagick { - public class ImageMagickEncoder : IImageEncoder + public class ImageMagickEncoder : IImageEncoder, IDisposable { private readonly ILogger _logger; private readonly IApplicationPaths _appPaths; @@ -38,7 +38,8 @@ namespace Emby.Drawing.ImageMagick // Some common file name extensions for RAW picture files include: .cr2, .crw, .dng, .nef, .orf, .rw2, .pef, .arw, .sr2, .srf, and .tif. return new[] { - "tiff", + "tiff", + "tif", "jpeg", "jpg", "png", @@ -327,6 +328,7 @@ namespace Emby.Drawing.ImageMagick { _disposed = true; Wand.CloseEnvironment(); + GC.SuppressFinalize(this); } private void CheckDisposed() diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index b5d6010b07..0eaa966097 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -193,30 +193,31 @@ namespace Emby.Drawing.Skia { using (var stream = new SKFileStream(path)) { - var codec = SKCodec.Create(stream); - - if (codec == null) + using (var codec = SKCodec.Create(stream)) { - origin = SKCodecOrigin.TopLeft; - return null; - } + if (codec == null) + { + origin = SKCodecOrigin.TopLeft; + return null; + } - // create the bitmap - var bitmap = new SKBitmap(codec.Info.Width, codec.Info.Height, !requiresTransparencyHack); + // create the bitmap + var bitmap = new SKBitmap(codec.Info.Width, codec.Info.Height, !requiresTransparencyHack); - if (bitmap != null) - { - // decode - codec.GetPixels(bitmap.Info, bitmap.GetPixels()); + if (bitmap != null) + { + // decode + codec.GetPixels(bitmap.Info, bitmap.GetPixels()); - origin = codec.Origin; - } - else - { - origin = SKCodecOrigin.TopLeft; - } + origin = codec.Origin; + } + else + { + origin = SKCodecOrigin.TopLeft; + } - return bitmap; + return bitmap; + } } } @@ -593,10 +594,6 @@ namespace Emby.Drawing.Skia get { return "Skia"; } } - public void Dispose() - { - } - public bool SupportsImageCollageCreation { get { return true; } diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 356343baee..1d3f4a8e39 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -126,6 +126,7 @@ namespace Emby.Drawing return new string[] { "tiff", + "tif", "jpeg", "jpg", "png", @@ -967,8 +968,15 @@ namespace Emby.Drawing public void Dispose() { _disposed = true; - _imageEncoder.Dispose(); + + var disposable = _imageEncoder as IDisposable; + if (disposable != null) + { + disposable.Dispose(); + } + _saveImageSizeTimer.Dispose(); + GC.SuppressFinalize(this); } private void CheckDisposed() diff --git a/Emby.Drawing/NullImageEncoder.cs b/Emby.Drawing/NullImageEncoder.cs index f04e8aaf1e..95ea42ecf2 100644 --- a/Emby.Drawing/NullImageEncoder.cs +++ b/Emby.Drawing/NullImageEncoder.cs @@ -61,9 +61,5 @@ namespace Emby.Drawing { throw new NotImplementedException(); } - - public void Dispose() - { - } } } diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index 1b6daca73b..4e448ac64c 100644 --- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs +++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs @@ -491,6 +491,7 @@ namespace Emby.Server.Implementations.Activity //_logManager.LoggerLoaded -= _logManager_LoggerLoaded; _appHost.ApplicationUpdated -= _appHost_ApplicationUpdated; + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index b264cffe65..b3268b156b 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -828,7 +828,7 @@ namespace Emby.Server.Implementations RegisterSingleInstance(MemoryStreamFactory); RegisterSingleInstance(SystemEvents); - RegisterSingleInstance(LogManager); + RegisterSingleInstance(LogManager, false); RegisterSingleInstance(Logger); RegisterSingleInstance(EnvironmentInfo); @@ -2341,6 +2341,7 @@ namespace Emby.Server.Implementations _disposed = true; Dispose(true); + GC.SuppressFinalize(this); } } @@ -2354,6 +2355,7 @@ namespace Emby.Server.Implementations { var type = GetType(); + LogManager.AddConsoleOutput(); Logger.Info("Disposing " + type.Name); var parts = DisposableParts.Distinct().Where(i => i.GetType() != type).ToList(); diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index e842005a5e..2f726f8abc 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -1624,6 +1624,7 @@ namespace Emby.Server.Implementations.Channels public void Dispose() { + GC.SuppressFinalize(this); } } } \ No newline at end of file diff --git a/Emby.Server.Implementations/Data/ManagedConnection.cs b/Emby.Server.Implementations/Data/ManagedConnection.cs index 91a2dfdf62..5d0fc8ebc7 100644 --- a/Emby.Server.Implementations/Data/ManagedConnection.cs +++ b/Emby.Server.Implementations/Data/ManagedConnection.cs @@ -77,6 +77,7 @@ namespace Emby.Server.Implementations.Data { Close(); } + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs index 09b8bf22cd..a0a5f32ef6 100644 --- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs +++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs @@ -104,6 +104,7 @@ namespace Emby.Server.Implementations.Diagnostics public void Dispose() { _process.Dispose(); + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs index 561f5ee12e..c2cee00c80 100644 --- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs @@ -112,6 +112,7 @@ namespace Emby.Server.Implementations.EntryPoints _appHost.HasPendingRestartChanged -= _appHost_HasPendingRestartChanged; DisposeTimer(); + GC.SuppressFinalize(this); } private void DisposeTimer() diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index c96799b2f8..9b434d606d 100644 --- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -294,6 +294,7 @@ namespace Emby.Server.Implementations.EntryPoints { _disposed = true; DisposeNat(); + GC.SuppressFinalize(this); } private void DisposeNat() diff --git a/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs b/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs index 8ae85e3909..221580681a 100644 --- a/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs +++ b/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs @@ -60,6 +60,7 @@ namespace Emby.Server.Implementations.EntryPoints _timer.Dispose(); _timer = null; } + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 80a188bc0f..796d8cf482 100644 --- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -426,6 +426,7 @@ namespace Emby.Server.Implementations.EntryPoints public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/EntryPoints/LoadRegistrations.cs b/Emby.Server.Implementations/EntryPoints/LoadRegistrations.cs index 0203b51928..21e075cf5c 100644 --- a/Emby.Server.Implementations/EntryPoints/LoadRegistrations.cs +++ b/Emby.Server.Implementations/EntryPoints/LoadRegistrations.cs @@ -68,6 +68,7 @@ namespace Emby.Server.Implementations.EntryPoints _timer.Dispose(); _timer = null; } + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs index b674fc39bb..f73b40b462 100644 --- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs @@ -72,6 +72,7 @@ namespace Emby.Server.Implementations.EntryPoints _liveTvManager.SeriesTimerCancelled -= _liveTvManager_SeriesTimerCancelled; _liveTvManager.TimerCreated -= _liveTvManager_TimerCreated; _liveTvManager.SeriesTimerCreated -= _liveTvManager_SeriesTimerCreated; + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs b/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs index 77de849a17..13e14be36f 100644 --- a/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs +++ b/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Library; +using System; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Plugins; using System.Threading; @@ -36,6 +37,7 @@ namespace Emby.Server.Implementations.EntryPoints /// public void Dispose() { + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs index 4d640bc95d..514321e209 100644 --- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs @@ -174,6 +174,7 @@ namespace Emby.Server.Implementations.EntryPoints public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs index 424153f220..614c04fd22 100644 --- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs +++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs @@ -1,4 +1,5 @@ -using Emby.Server.Implementations.Browser; +using System; +using Emby.Server.Implementations.Browser; using MediaBrowser.Controller; using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Logging; @@ -54,6 +55,7 @@ namespace Emby.Server.Implementations.EntryPoints /// public void Dispose() { + GC.SuppressFinalize(this); } } } \ No newline at end of file diff --git a/Emby.Server.Implementations/EntryPoints/SystemEvents.cs b/Emby.Server.Implementations/EntryPoints/SystemEvents.cs index 4ab6d32f35..aa63dae274 100644 --- a/Emby.Server.Implementations/EntryPoints/SystemEvents.cs +++ b/Emby.Server.Implementations/EntryPoints/SystemEvents.cs @@ -43,6 +43,7 @@ namespace Emby.Server.Implementations.EntryPoints public void Dispose() { _systemEvents.SystemShutdown -= _systemEvents_SystemShutdown; + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs index df5a7c985d..d04df0d2b2 100644 --- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs @@ -65,6 +65,7 @@ namespace Emby.Server.Implementations.EntryPoints public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs index 99d39ffe02..fb94029861 100644 --- a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs @@ -130,6 +130,7 @@ namespace Emby.Server.Implementations.EntryPoints public void Dispose() { _sessionManager.SessionStarted -= _sessionManager_SessionStarted; + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index accdc5e9d4..4a7182a43c 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -160,6 +160,7 @@ namespace Emby.Server.Implementations.EntryPoints } _userDataManager.UserDataSaved -= _userDataManager_UserDataSaved; + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs index f512b723d8..fe545ecffd 100644 --- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs @@ -822,27 +822,6 @@ namespace Emby.Server.Implementations.HttpClientManager return url; } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) - { - if (dispose) - { - _httpClients.Clear(); - } - } - /// /// Throws the cancellation exception. /// diff --git a/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs b/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs index 9823a2ff50..cc7a4557eb 100644 --- a/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs +++ b/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs @@ -123,6 +123,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs index 0ec62d8958..20de8a5180 100644 --- a/Emby.Server.Implementations/IO/FileRefresher.cs +++ b/Emby.Server.Implementations/IO/FileRefresher.cs @@ -238,6 +238,7 @@ namespace Emby.Server.Implementations.IO { _disposed = true; DisposeTimer(); + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/IO/IsoManager.cs b/Emby.Server.Implementations/IO/IsoManager.cs index 903d5f301f..dc0b9e122e 100644 --- a/Emby.Server.Implementations/IO/IsoManager.cs +++ b/Emby.Server.Implementations/IO/IsoManager.cs @@ -70,6 +70,7 @@ namespace Emby.Server.Implementations.IO { mounter.Dispose(); } + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index 3994e2b007..56b10a7e6a 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -649,6 +649,7 @@ namespace Emby.Server.Implementations.IO public void Dispose() { + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 6e0489d887..d60a043533 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -524,6 +524,7 @@ namespace Emby.Server.Implementations.Library public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } private readonly object _disposeLock = new object(); diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 885e3b0eef..92a47bddc8 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2630,6 +2630,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { pair.Value.CancellationTokenSource.Cancel(); } + GC.SuppressFinalize(this); } public List GetRecordingFolders() diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs index 139cf570ee..7c5f630a70 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Plugins; +using System; +using MediaBrowser.Controller.Plugins; namespace Emby.Server.Implementations.LiveTv.EmbyTV { @@ -11,6 +12,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public void Dispose() { + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 089af2a019..b243c6599a 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2779,6 +2779,7 @@ namespace Emby.Server.Implementations.LiveTv public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } private bool _isDisposed = false; diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index eae29bee70..f974b5c2c7 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun SupportsTranscoding = true, IsInfiniteStream = true, IgnoreDts = true, - //SupportsProbing = false, + SupportsProbing = false, //AnalyzeDurationMs = 2000000 //IgnoreIndex = true, //ReadAtNativeFramerate = true diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs index 41b058baf7..c737c4cbae 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs @@ -99,6 +99,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun var task = StopStreaming(); Task.WaitAll(task); + GC.SuppressFinalize(this); } public async Task CheckTunerAvailability(IpAddressInfo remoteIp, int tuner, CancellationToken cancellationToken) diff --git a/Emby.Server.Implementations/Logging/SimpleLogManager.cs b/Emby.Server.Implementations/Logging/SimpleLogManager.cs index 3a69926575..6129f38c4d 100644 --- a/Emby.Server.Implementations/Logging/SimpleLogManager.cs +++ b/Emby.Server.Implementations/Logging/SimpleLogManager.cs @@ -107,6 +107,7 @@ namespace Emby.Server.Implementations.Logging } _fileLogger = null; + GC.SuppressFinalize(this); } } @@ -130,13 +131,18 @@ namespace Emby.Server.Implementations.Logging private void LogInternal() { - while (!_cancellationTokenSource.IsCancellationRequested) + while (!_cancellationTokenSource.IsCancellationRequested && !_disposed) { try { foreach (var message in _queue.GetConsumingEnumerable()) { var bytes = Encoding.UTF8.GetBytes(message + Environment.NewLine); + if (_disposed) + { + return; + } + _fileStream.Write(bytes, 0, bytes.Length); _fileStream.Flush(true); @@ -166,17 +172,18 @@ namespace Emby.Server.Implementations.Logging return; } - _fileStream.Flush(); + _fileStream.Flush(true); } public void Dispose() { _cancellationTokenSource.Cancel(); - _disposed = true; + Flush(); - _fileStream.Flush(); + _disposed = true; _fileStream.Dispose(); + GC.SuppressFinalize(this); } } diff --git a/Emby.Server.Implementations/Net/NetAcceptSocket.cs b/Emby.Server.Implementations/Net/NetAcceptSocket.cs index 93638a3673..d80341a077 100644 --- a/Emby.Server.Implementations/Net/NetAcceptSocket.cs +++ b/Emby.Server.Implementations/Net/NetAcceptSocket.cs @@ -92,6 +92,7 @@ namespace Emby.Server.Implementations.Net public void Dispose() { Socket.Dispose(); + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/News/NewsEntryPoint.cs b/Emby.Server.Implementations/News/NewsEntryPoint.cs index 3c9a3bbf1d..03c79c2c1e 100644 --- a/Emby.Server.Implementations/News/NewsEntryPoint.cs +++ b/Emby.Server.Implementations/News/NewsEntryPoint.cs @@ -271,6 +271,7 @@ namespace Emby.Server.Implementations.News _timer.Dispose(); _timer = null; } + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/Notifications/Notifications.cs b/Emby.Server.Implementations/Notifications/Notifications.cs index ac3cc75647..09c1f07e0b 100644 --- a/Emby.Server.Implementations/Notifications/Notifications.cs +++ b/Emby.Server.Implementations/Notifications/Notifications.cs @@ -551,6 +551,7 @@ namespace Emby.Server.Implementations.Notifications _deviceManager.CameraImageUploaded -= _deviceManager_CameraImageUploaded; _userManager.UserLockedOut -= _userManager_UserLockedOut; + GC.SuppressFinalize(this); } private void DisposeLibraryUpdateTimer() diff --git a/Emby.Server.Implementations/Notifications/WebSocketNotifier.cs b/Emby.Server.Implementations/Notifications/WebSocketNotifier.cs index 0d89ba84f3..6e57e7f816 100644 --- a/Emby.Server.Implementations/Notifications/WebSocketNotifier.cs +++ b/Emby.Server.Implementations/Notifications/WebSocketNotifier.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Net; +using System; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Notifications; using MediaBrowser.Controller.Plugins; using System.Linq; @@ -49,6 +50,7 @@ namespace Emby.Server.Implementations.Notifications public void Dispose() { _notificationsRepo.NotificationAdded -= _notificationsRepo_NotificationAdded; + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs index dbac76bb49..bd53da1bdb 100644 --- a/Emby.Server.Implementations/Session/HttpSessionController.cs +++ b/Emby.Server.Implementations/Session/HttpSessionController.cs @@ -14,7 +14,7 @@ using System.Threading.Tasks; namespace Emby.Server.Implementations.Session { - public class HttpSessionController : ISessionController, IDisposable + public class HttpSessionController : ISessionController { private readonly IHttpClient _httpClient; private readonly IJsonSerializer _json; @@ -195,9 +195,5 @@ namespace Emby.Server.Implementations.Session return "?" + args; } - - public void Dispose() - { - } } } diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs index 2735bb2378..a5af843dbd 100644 --- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs @@ -102,6 +102,7 @@ namespace Emby.Server.Implementations.Session public void Dispose() { _serverManager.WebSocketConnected -= _serverManager_WebSocketConnected; + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs index f0ff0b5ddd..ee9ee8969e 100644 --- a/Emby.Server.Implementations/Session/WebSocketController.cs +++ b/Emby.Server.Implementations/Session/WebSocketController.cs @@ -283,6 +283,7 @@ namespace Emby.Server.Implementations.Session { socket.Closed -= connection_Closed; } + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/TV/SeriesPostScanTask.cs b/Emby.Server.Implementations/TV/SeriesPostScanTask.cs index 23b6a3cb57..764df8baf2 100644 --- a/Emby.Server.Implementations/TV/SeriesPostScanTask.cs +++ b/Emby.Server.Implementations/TV/SeriesPostScanTask.cs @@ -217,6 +217,7 @@ namespace Emby.Server.Implementations.TV public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } /// diff --git a/Emby.Server.Implementations/Threading/CommonTimer.cs b/Emby.Server.Implementations/Threading/CommonTimer.cs index 9451b07f32..bb67325d14 100644 --- a/Emby.Server.Implementations/Threading/CommonTimer.cs +++ b/Emby.Server.Implementations/Threading/CommonTimer.cs @@ -31,6 +31,7 @@ namespace Emby.Server.Implementations.Threading public void Dispose() { _timer.Dispose(); + GC.SuppressFinalize(this); } } } diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 75328a39a3..1804630403 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -722,6 +722,7 @@ namespace Emby.Server.Implementations.Updates public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 21552617da..04cef60bfc 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -81,18 +81,14 @@ namespace MediaBrowser.Api return value.Split(separator); } - /// - /// Runs this instance. - /// public void Run() { + } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// public void Dispose() { + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Api/BasePeriodicWebSocketListener.cs b/MediaBrowser.Api/BasePeriodicWebSocketListener.cs index 8004d7e9bf..c7a9d97bad 100644 --- a/MediaBrowser.Api/BasePeriodicWebSocketListener.cs +++ b/MediaBrowser.Api/BasePeriodicWebSocketListener.cs @@ -314,6 +314,7 @@ namespace MediaBrowser.Api public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } } diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs index ed941a4474..0d7fb69cb6 100644 --- a/MediaBrowser.Common/Net/HttpResponseInfo.cs +++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs @@ -70,6 +70,7 @@ namespace MediaBrowser.Common.Net { _disposable.Dispose(); } + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs index 4eabbc8034..15257715f5 100644 --- a/MediaBrowser.Common/Net/IHttpClient.cs +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -9,7 +9,7 @@ namespace MediaBrowser.Common.Net /// /// Interface IHttpClient /// - public interface IHttpClient : IDisposable + public interface IHttpClient { /// /// Gets the response. diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs index 503f3f407a..5b318c6a78 100644 --- a/MediaBrowser.Common/Progress/ActionableProgress.cs +++ b/MediaBrowser.Common/Progress/ActionableProgress.cs @@ -30,6 +30,7 @@ namespace MediaBrowser.Common.Progress public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } /// diff --git a/MediaBrowser.Controller/Drawing/IImageEncoder.cs b/MediaBrowser.Controller/Drawing/IImageEncoder.cs index 131d0bd9ed..757448eb26 100644 --- a/MediaBrowser.Controller/Drawing/IImageEncoder.cs +++ b/MediaBrowser.Controller/Drawing/IImageEncoder.cs @@ -3,7 +3,7 @@ using MediaBrowser.Model.Drawing; namespace MediaBrowser.Controller.Drawing { - public interface IImageEncoder : IDisposable + public interface IImageEncoder { /// /// Gets the supported input formats. diff --git a/MediaBrowser.Controller/Drawing/ImageStream.cs b/MediaBrowser.Controller/Drawing/ImageStream.cs index 353abaca33..b5e14eb6c8 100644 --- a/MediaBrowser.Controller/Drawing/ImageStream.cs +++ b/MediaBrowser.Controller/Drawing/ImageStream.cs @@ -23,6 +23,7 @@ namespace MediaBrowser.Controller.Drawing { Stream.Dispose(); } + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 90c1de2f2b..367a7a4675 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -303,6 +303,7 @@ namespace MediaBrowser.Controller.Session StopAutomaticProgress(); _sessionManager = null; + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Model/Net/HttpResponse.cs b/MediaBrowser.Model/Net/HttpResponse.cs index f4bd8e681d..7c3d1d73df 100644 --- a/MediaBrowser.Model/Net/HttpResponse.cs +++ b/MediaBrowser.Model/Net/HttpResponse.cs @@ -59,6 +59,7 @@ namespace MediaBrowser.Model.Net { _disposable.Dispose(); } + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index d249b6b002..c36d4cf63c 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -1110,6 +1110,7 @@ namespace MediaBrowser.Providers.Manager { _disposeCancellationTokenSource.Cancel(); } + GC.SuppressFinalize(this); } } } \ No newline at end of file diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index ec1c497426..fe798d4f0f 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -29,7 +29,7 @@ namespace MediaBrowser.Providers.Movies /// /// Class MovieDbProvider /// - public class MovieDbProvider : IRemoteMetadataProvider, IDisposable, IHasOrder + public class MovieDbProvider : IRemoteMetadataProvider, IHasOrder { internal static MovieDbProvider Current { get; private set; } @@ -130,14 +130,6 @@ namespace MediaBrowser.Providers.Movies get { return "TheMovieDb"; } } - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) - { - } - /// /// The _TMDB settings task /// @@ -434,11 +426,6 @@ namespace MediaBrowser.Providers.Movies return await _httpClient.Get(options).ConfigureAwait(false); } - public void Dispose() - { - Dispose(true); - } - /// /// Class TmdbTitle /// diff --git a/MediaBrowser.Server.Mac/Main.cs b/MediaBrowser.Server.Mac/Main.cs index 3863937f8a..6af58e66c1 100644 --- a/MediaBrowser.Server.Mac/Main.cs +++ b/MediaBrowser.Server.Mac/Main.cs @@ -56,20 +56,22 @@ namespace MediaBrowser.Server.Mac var appPaths = CreateApplicationPaths(appFolderPath, customProgramDataPath); - var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server"); - logManager.ReloadLogger(LogSeverity.Info); - logManager.AddConsoleOutput(); + using (var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server")) + { + logManager.ReloadLogger(LogSeverity.Info); + logManager.AddConsoleOutput(); - var logger = _logger = logManager.GetLogger("Main"); + var logger = _logger = logManager.GetLogger("Main"); - ApplicationHost.LogEnvironmentInfo(logger, appPaths, true); + ApplicationHost.LogEnvironmentInfo(logger, appPaths, true); - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - StartApplication(appPaths, logManager, options); - NSApplication.Init (); - NSApplication.Main (args); - } + StartApplication(appPaths, logManager, options); + NSApplication.Init(); + NSApplication.Main(args); + } + } private static ServerApplicationPaths CreateApplicationPaths(string appFolderPath, string programDataPath) { diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 21278e00d7..98ad8bb026 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -50,28 +50,30 @@ namespace MediaBrowser.Server.Mono var appPaths = CreateApplicationPaths(applicationPath, customProgramDataPath); - var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server"); - logManager.ReloadLogger(LogSeverity.Info); - logManager.AddConsoleOutput(); + using (var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server")) + { + logManager.ReloadLogger(LogSeverity.Info); + logManager.AddConsoleOutput(); - var logger = _logger = logManager.GetLogger("Main"); + var logger = _logger = logManager.GetLogger("Main"); - ApplicationHost.LogEnvironmentInfo(logger, appPaths, true); - - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + ApplicationHost.LogEnvironmentInfo(logger, appPaths, true); - try - { - RunApplication(appPaths, logManager, options); - } - finally - { - _logger.Info("Disposing app host"); - _appHost.Dispose(); + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - if (_restartOnShutdown) + try { - StartNewInstance(options); + RunApplication(appPaths, logManager, options); + } + finally + { + _logger.Info("Disposing app host"); + _appHost.Dispose(); + + if (_restartOnShutdown) + { + StartNewInstance(options); + } } } } diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 1429824ff1..31acd18200 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -72,69 +72,71 @@ namespace MediaBrowser.ServerApplication var appPaths = CreateApplicationPaths(ApplicationPath, IsRunningAsService); - var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server"); - logManager.ReloadLogger(LogSeverity.Debug); - logManager.AddConsoleOutput(); + using (var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server")) + { + logManager.ReloadLogger(LogSeverity.Debug); + logManager.AddConsoleOutput(); - var logger = _logger = logManager.GetLogger("Main"); + var logger = _logger = logManager.GetLogger("Main"); - ApplicationHost.LogEnvironmentInfo(logger, appPaths, true); + ApplicationHost.LogEnvironmentInfo(logger, appPaths, true); - // Install directly - if (options.ContainsOption("-installservice")) - { - logger.Info("Performing service installation"); - InstallService(ApplicationPath, logger); - return; - } + // Install directly + if (options.ContainsOption("-installservice")) + { + logger.Info("Performing service installation"); + InstallService(ApplicationPath, logger); + return; + } - // Restart with admin rights, then install - if (options.ContainsOption("-installserviceasadmin")) - { - logger.Info("Performing service installation"); - RunServiceInstallation(ApplicationPath); - return; - } + // Restart with admin rights, then install + if (options.ContainsOption("-installserviceasadmin")) + { + logger.Info("Performing service installation"); + RunServiceInstallation(ApplicationPath); + return; + } - // Uninstall directly - if (options.ContainsOption("-uninstallservice")) - { - logger.Info("Performing service uninstallation"); - UninstallService(ApplicationPath, logger); - return; - } + // Uninstall directly + if (options.ContainsOption("-uninstallservice")) + { + logger.Info("Performing service uninstallation"); + UninstallService(ApplicationPath, logger); + return; + } - // Restart with admin rights, then uninstall - if (options.ContainsOption("-uninstallserviceasadmin")) - { - logger.Info("Performing service uninstallation"); - RunServiceUninstallation(ApplicationPath); - return; - } + // Restart with admin rights, then uninstall + if (options.ContainsOption("-uninstallserviceasadmin")) + { + logger.Info("Performing service uninstallation"); + RunServiceUninstallation(ApplicationPath); + return; + } - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - RunServiceInstallationIfNeeded(ApplicationPath); + RunServiceInstallationIfNeeded(ApplicationPath); - if (IsAlreadyRunning(ApplicationPath, currentProcess)) - { - logger.Info("Shutting down because another instance of Emby Server is already running."); - return; - } + if (IsAlreadyRunning(ApplicationPath, currentProcess)) + { + logger.Info("Shutting down because another instance of Emby Server is already running."); + return; + } - if (PerformUpdateIfNeeded(appPaths, logger)) - { - logger.Info("Exiting to perform application update."); - return; - } + if (PerformUpdateIfNeeded(appPaths, logger)) + { + logger.Info("Exiting to perform application update."); + return; + } - try - { - RunApplication(appPaths, logManager, IsRunningAsService, options); - } - finally - { - OnServiceShutdown(); + try + { + RunApplication(appPaths, logManager, IsRunningAsService, options); + } + finally + { + OnServiceShutdown(); + } } } diff --git a/MediaBrowser.XbmcMetadata/EntryPoint.cs b/MediaBrowser.XbmcMetadata/EntryPoint.cs index b1c687a6e3..98460f767e 100644 --- a/MediaBrowser.XbmcMetadata/EntryPoint.cs +++ b/MediaBrowser.XbmcMetadata/EntryPoint.cs @@ -81,6 +81,7 @@ namespace MediaBrowser.XbmcMetadata public void Dispose() { _userDataManager.UserDataSaved -= _userDataManager_UserDataSaved; + GC.SuppressFinalize(this); } private async void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason) diff --git a/SharedVersion.cs b/SharedVersion.cs index fe1bfdeb6b..85588a9af8 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.30.7")] +[assembly: AssemblyVersion("3.2.30.8")] diff --git a/SocketHttpListener/Net/HttpListener.cs b/SocketHttpListener/Net/HttpListener.cs index 4ae472f9ea..32c5e90e09 100644 --- a/SocketHttpListener/Net/HttpListener.cs +++ b/SocketHttpListener/Net/HttpListener.cs @@ -248,6 +248,7 @@ namespace SocketHttpListener.Net Close(true); //TODO: Should we force here or not? disposed = true; + GC.SuppressFinalize(this); } internal void CheckDisposed() diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs index 9966d3fcf9..57c075e322 100644 --- a/SocketHttpListener/WebSocket.cs +++ b/SocketHttpListener/WebSocket.cs @@ -880,6 +880,7 @@ namespace SocketHttpListener void IDisposable.Dispose() { Close(CloseStatusCode.Away, null); + GC.SuppressFinalize(this); } #endregion