Microsoft.AspNetCore.SignalR.Hubs.ReflectedHubDescriptorProvider.GetTypesSafe C# (CSharp) Method

GetTypesSafe() private method

private GetTypesSafe ( Assembly a ) : IEnumerable
a System.Reflection.Assembly
return IEnumerable
        private IEnumerable<Type> GetTypesSafe(Assembly a)
        {
            try
            {
                return a.GetTypes();
            }
            catch (ReflectionTypeLoadException ex)
            {
                _logger.LogWarning(
                    "Some of the classes from assembly \"{0}\" could Not be loaded when searching for Hubs. [{1}]" + Environment.NewLine +
                    "Original exception type: {2}" + Environment.NewLine +
                    "Original exception message: {3}" + Environment.NewLine,
                    a.FullName,
#if NET451
                    a.Location,
#else
                    null,
#endif
                    ex.GetType().Name,
                    ex.Message);

                if (ex.LoaderExceptions != null)
                {
                    _logger.LogWarning("Loader exceptions messages: ");

                    foreach (var exception in ex.LoaderExceptions)
                    {
                        _logger.LogWarning("{0}" + Environment.NewLine, exception);
                    }
                }

                return ex.Types.Where(t => t != null);
            }
            catch (Exception ex)
            {
                // REVIEW: Figure out how to disabiguate here
                _logger.LogWarning("None of the classes from assembly \"{0}\" could be loaded when searching for Hubs. [{1}]\r\n" +
                                     "Original exception type: {2}\r\n" +
                                     "Original exception message: {3}\r\n",
                                     a.FullName,
#if NET451
                                     a.Location,
#else
                                     null,
#endif
                                     ex.GetType().Name,
                                     ex.Message);

                return Enumerable.Empty<Type>();
            }
        }
    }