<commit_before>namespace MassTransit.ServiceBus.Formatters
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class MessageFinder
    {
        private static readonly List<Type> _messageTypes = new List<Type>();


        public static void Initialize()
        {
            lock (_messageTypes)
            {
                _messageTypes.Clear();
               
                Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
                Type messageType = typeof (IMessage);

                foreach (Assembly assembly in assemblies)
                {
                    if (DoesAssemblyReferenceMassTransit(assembly))
                    {
                        Type[] types = assembly.GetTypes();

                        foreach (Type type in types)
                        {
                            if (type.IsAbstract || type.IsInterface)
                                continue;

							if (type.ContainsGenericParameters)
								continue;

                            if (messageType.IsAssignableFrom(type))
                                _messageTypes.Add(type);
                        }
                    }
                }
            }
        }

        public static bool DoesAssemblyReferenceMassTransit(Assembly assembly)
        {
            bool result = false;
            AssemblyName[] names = assembly.GetReferencedAssemblies();

            foreach (AssemblyName name in names)
            {
                if(name.Name.Contains("MassTransit"))
                {
                    result = true;
                    break;
                }
            }

            return result;
        }
        public static List<Type> AllMessageTypes()
        {
            Initialize();
            return _messageTypes;
        }
    }
}<commit_msg>No need to reflect every time unless we have to at some point.<commit_after>namespace MassTransit.ServiceBus.Formatters
{
	using System;
	using System.Collections.Generic;
	using System.Reflection;

	public class MessageFinder
	{
		private static readonly List<Type> _messageTypes = new List<Type>();

		public static void Initialize()
		{
			lock (_messageTypes)
			{
				_messageTypes.Clear();

				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				Type messageType = typeof (IMessage);

				foreach (Assembly assembly in assemblies)
				{
					Type[] types = assembly.GetTypes();

					foreach (Type type in types)
					{
						if (type.IsAbstract || type.IsInterface)
							continue;

						if (type.ContainsGenericParameters)
							continue;

						if (messageType.IsAssignableFrom(type))
							_messageTypes.Add(type);
					}
				}
			}
		}

		public static List<Type> AllMessageTypes()
		{
			if (_messageTypes.Count == 0)
				Initialize();

			return _messageTypes;
		}
	}
}
{'fraction_non_alphanumeric': 0.0793151642208246, 'fraction_numerical': 0.00034940600978336826, 'mean_word_length': 1.5723270440251573, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6640621', 'n_tokens_mistral': 816, 'n_tokens_neox': 671, 'n_words': 163}