A library that extracts “critical” machine information for debugging purposes?

Critical machine information will be logged and should be used for debugging purposes when our software is in the field.

Critical information may include data that is “usually” important for debugging an application. It may include:

  • operating system
  • Installed Windows Updates
  • Hardware Information: CPU, RAM, HDD
  • Process / Services in progress
  • Current user account

Sorry to ask such a vague question, and I find it pretty simple to write a user interface with WMI. But, if you already have a library / framework that is designed for this kind of thing, it would be great not to reinvent the wheel.

+2
source share
1 answer

Try something like this, pseudocode!

        private StringBuilder GetSystemInformationString()
        {
            StringBuilder sb = new StringBuilder();
            PropertyInfo[] properties = typeof(System.Windows.Forms.SystemInformation).GetProperties();
            if (properties != null && properties.Length > 0)
            {
                foreach (PropertyInfo pin in properties)
                {
                    sb.Append(System.Environment.NewLine);
                    sb.Append(pin.Name + " : " + pin.GetValue(pin, null));
                }
            }

            return sb;

        }

for memory, you can use something like this:

(System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1024).ToString() + " Kb";

Sincerely.

+1
source

All Articles