diff --git a/Box.V2/Managers/BoxResourceManager.cs b/Box.V2/Managers/BoxResourceManager.cs index c05d3a982..32bfa59ae 100644 --- a/Box.V2/Managers/BoxResourceManager.cs +++ b/Box.V2/Managers/BoxResourceManager.cs @@ -356,14 +356,21 @@ private string CheckFor462PlusVersion(int releaseKey) private string GetNetCoreVersion() { - var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; - if (assembly?.CodeBase != null) + try + { + var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; + if (assembly?.CodeBase != null) + { + var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); + var netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); + return netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2 ? + assemblyPath[netCoreAppIndex + 1] : + null; + } + } + catch { - var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); - var netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); - return netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2 ? - assemblyPath[netCoreAppIndex + 1] : - null; + return null; } #if NETSTANDARD2_0