<commit_before>namespace MassTransit.Metadata
{
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Reflection;


    [Serializable]
    public class BusHostInfo :
        HostInfo
    {
        public BusHostInfo()
        {
        }

        public BusHostInfo(bool initialize)
        {
            FrameworkVersion = Environment.Version.ToString();
            OperatingSystemVersion = Environment.OSVersion.ToString();
            var entryAssembly = System.Reflection.Assembly.GetEntryAssembly() ?? System.Reflection.Assembly.GetCallingAssembly();
            MachineName = Environment.MachineName;
            MassTransitVersion = typeof(IBus).GetTypeInfo().Assembly.GetName().Version.ToString();

            using var currentProcess = Process.GetCurrentProcess();
            ProcessId = currentProcess.Id;
            ProcessName = currentProcess.ProcessName;
            if ("dotnet".Equals(ProcessName, StringComparison.OrdinalIgnoreCase))
                ProcessName = GetUsefulProcessName(ProcessName);

            var assemblyName = entryAssembly.GetName();
            Assembly = assemblyName.Name;
            AssemblyVersion = assemblyName.Version.ToString();
        }

        public string MachineName { get; private set; }
        public string ProcessName { get; private set; }
        public int ProcessId { get; private set; }<commit_msg>Fixed #2257 - catch exception on process info<commit_after>namespace MassTransit.Metadata
{
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Reflection;


    [Serializable]
    public class BusHostInfo :
        HostInfo
    {
        public BusHostInfo()
        {
        }

        public BusHostInfo(bool initialize)
        {
            FrameworkVersion = Environment.Version.ToString();
            OperatingSystemVersion = Environment.OSVersion.ToString();
            var entryAssembly = System.Reflection.Assembly.GetEntryAssembly() ?? System.Reflection.Assembly.GetCallingAssembly();
            MachineName = Environment.MachineName;
            MassTransitVersion = typeof(IBus).GetTypeInfo().Assembly.GetName().Version.ToString();

            try
            {
                using var currentProcess = Process.GetCurrentProcess();
                ProcessId = currentProcess.Id;
                ProcessName = currentProcess.ProcessName;
                if ("dotnet".Equals(ProcessName, StringComparison.OrdinalIgnoreCase))
                    ProcessName = GetUsefulProcessName(ProcessName);
            }
            catch (PlatformNotSupportedException)
            {
                ProcessId = 0;
                ProcessName = GetUsefulProcessName("UWP");
            }

            var assemblyName = entryAssembly.GetName();
            Assembly = assemblyName.Name;
            AssemblyVersion = assemblyName.Version.ToString();
        }

        public string MachineName { get; private set; }
        public string ProcessName { get; private set; }
        public int ProcessId { get; private set; }
{'fraction_non_alphanumeric': 0.08229915088177661, 'fraction_numerical': 0.0016329196603527107, 'mean_word_length': 2.251592356687898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6956123', 'n_tokens_mistral': 718, 'n_tokens_neox': 696, 'n_words': 153}