Skip to content

Commit

Permalink
Add basic computer information to error in case of an internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingWonders committed Mar 15, 2024
1 parent 2576505 commit 8f20fd1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ApplicationEvents.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Imports Microsoft.Win32
Imports Microsoft.VisualBasic.ControlChars
Imports System.Management

Namespace My
' Los siguientes eventos están disponibles para MyApplication:
Expand All @@ -21,6 +22,45 @@ Namespace My
ExceptionForm.ErrorText.Text = e.Exception.ToString() & CrLf & CrLf &
"Error Message: " & e.Exception.Message & CrLf & CrLf &
"Error Code (HRESULT): " & e.Exception.HResult
Try
' Get basic information about the system. This does not include any personally identifiable information (PII) or
' serial numbers that can identify the computer this program is run on
Dim CS_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Manufacturer, Model FROM Win32_ComputerSystem")
Dim BIOS_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Name, Description, SMBIOSBIOSVersion FROM Win32_BIOS")
Dim Proc_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Name, Caption, Manufacturer, Family FROM Win32_Processor")
Dim CS_Results As ManagementObjectCollection = CS_Searcher.Get()
Dim BIOS_Results As ManagementObjectCollection = BIOS_Searcher.Get()
Dim Proc_Results As ManagementObjectCollection = Proc_Searcher.Get()
ExceptionForm.ErrorText.AppendText(CrLf & CrLf &
"Machine information:" & CrLf)
For Each CS_Result As ManagementObject In CS_Results
ExceptionForm.ErrorText.AppendText(" - Computer manufacturer: " & CS_Result("Manufacturer") & CrLf &
" - Computer model: " & CS_Result("Model") & CrLf)
Next
For Each BIOS_Result As ManagementObject In BIOS_Results
ExceptionForm.ErrorText.AppendText(" - BIOS name/description: " & BIOS_Result("Name") & " " & BIOS_Result("Description") & CrLf &
" - System Management BIOS (SMBIOS) version: " & BIOS_Result("SMBIOSBIOSVersion") & CrLf & CrLf)
Next
ExceptionForm.ErrorText.AppendText("Operating system information:" & CrLf &
" - OS name: " & My.Computer.Info.OSFullName & CrLf &
" - OS version: " & My.Computer.Info.OSVersion & CrLf &
" - OS Platform: " & My.Computer.Info.OSPlatform & CrLf &
" - Is a 64-bit system? " & If(Environment.Is64BitOperatingSystem, "Yes", "No") & CrLf & CrLf &
"Processor information:" & CrLf)
For Each Proc_Result As ManagementObject In Proc_Results
ExceptionForm.ErrorText.AppendText(" - Processor name: " & Proc_Result("Name") & CrLf &
" - Processor caption: " & Proc_Result("Caption") & CrLf &
" - Processor manufacturer: " & Proc_Result("Manufacturer") & CrLf &
" - Processor family (WMI type): " & Proc_Result("Family") & CrLf &
" NOTE: refer to the following website to get the exact family type of your processor:" & CrLf &
" https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor" & CrLf & CrLf)
Next
ExceptionForm.ErrorText.AppendText("This information is gathered to help isolate the issue to a specific hardware or software configuration. " &
"No information that can be used to identify the user or the exact system is gathered." & CrLf & CrLf &
"If you don't want to send this information to the developers, paste the text that was copied to the clipboard in a text editor, remove this information, and copy the new text again.")
Catch ex As Exception
' Could not get basic machine information
End Try
ExceptionForm.ShowDialog()
If ExceptionForm.DialogResult = DialogResult.OK Then
e.ExitApplication = False
Expand Down
Binary file modified Installer/Output/dt_setup.exe
Binary file not shown.

0 comments on commit 8f20fd1

Please sign in to comment.