From 990bd7d1eef46dba1e22a83d6144b769680e042c Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Fri, 27 Jan 2023 18:29:35 -0500 Subject: [PATCH] Initialize device id in constructor --- Emby.Server.Implementations/ApplicationHost.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 4ed055cdf4..c9720de1a5 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -118,6 +118,7 @@ namespace Emby.Server.Implementations /// The disposable parts. /// private readonly ConcurrentDictionary _disposableParts = new(); + private readonly DeviceId _deviceId; private readonly IFileSystem _fileSystemManager; private readonly IConfiguration _startupConfig; @@ -135,8 +136,6 @@ namespace Emby.Server.Implementations /// All concrete types. private Type[] _allConcreteTypes; - private DeviceId _deviceId; - private bool _disposed = false; /// @@ -160,6 +159,7 @@ namespace Emby.Server.Implementations Logger = LoggerFactory.CreateLogger(); _fileSystemManager.AddShortcutHandler(new MbLinkShortcutHandler(_fileSystemManager)); + _deviceId = new DeviceId(ApplicationPaths, LoggerFactory); ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version; ApplicationVersionString = ApplicationVersion.ToString(3); @@ -280,15 +280,7 @@ namespace Emby.Server.Implementations /// The application name. public string ApplicationProductName { get; } = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName; - public string SystemId - { - get - { - _deviceId ??= new DeviceId(ApplicationPaths, LoggerFactory); - - return _deviceId.Value; - } - } + public string SystemId => _deviceId.Value; /// public string Name => ApplicationProductName;