Microsoft.AspNet.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)
            {
                _trace.TraceWarning("Some of the classes from assembly \"{0}\" could Not be loaded when searching for Hubs. [{1}]\r\n" +
                                    "Original exception type: {2}\r\n" +
                                    "Original exception message: {3}\r\n",
                                    a.FullName,
                                    a.Location,
                                    ex.GetType().Name,
                                    ex.Message);

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

                    foreach (var exception in ex.LoaderExceptions)
                    {
                        _trace.TraceWarning("{0}\r\n", exception);
                    }
                }

                return ex.Types.Where(t => t != null);
            }
            catch (Exception ex)
            {
                _trace.TraceWarning("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,
                                    a.Location,
                                    ex.GetType().Name,
                                    ex.Message);

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