From 9cdc8b26a23f279ff194bfe63febf2f0aa8464d3 Mon Sep 17 00:00:00 2001 From: Jeffery Thompson Date: Wed, 22 Jan 2020 14:42:30 -0500 Subject: [PATCH] fix: catch PlatformNotSupportedException for linux systems --- ICD.Common.Utils/IcdEnvironment.Standard.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/ICD.Common.Utils/IcdEnvironment.Standard.cs b/ICD.Common.Utils/IcdEnvironment.Standard.cs index 62d607c..d734cc2 100644 --- a/ICD.Common.Utils/IcdEnvironment.Standard.cs +++ b/ICD.Common.Utils/IcdEnvironment.Standard.cs @@ -57,14 +57,21 @@ namespace ICD.Common.Utils { get { - bool enabled = - NetworkInterface.GetAllNetworkInterfaces() - .Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || - ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet) - .Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled) - .FirstOrDefault(); + try + { + bool enabled = + NetworkInterface.GetAllNetworkInterfaces() + .Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || + ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet) + .Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled) + .FirstOrDefault(); - return enabled.ToString(); + return enabled.ToString(); + } + catch(PlatformNotSupportedException) + { + return false.ToString(); + } } }