Duplicate sensor key causes ArgumentException in Dictionary when using LibreHardwareMonitorLib

Author: DeCarvalhoJrCreated Sep 20, 2026Updated Sep 20, 2026

Description

When running an application that uses LibreHardwareMonitorLib, a timer-based call to read hardware info throws an unhandled System.ArgumentException: "An item with the same key has already been added."

This suggests LibreHardwareMonitorLib is returning two sensors with identical identifiers, causing a Dictionary.Insert() collision in the consuming code.

Exception

System.ArgumentException: An item with the same key has already been added. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

Environment

  • LibreHardwareMonitorLib version: 0.9.5.0
  • OS: Windows (NET 4.8.x)
  • Hardware: Ryzen 7 5700x, RTX 5050 8GB, 48GB ram, b550 pro vdh

Steps to reproduce

  1. Run an app using LibreHardwareMonitorLib on a polling timer
  2. Exception is thrown periodically on sensor enumeration

Expected behavior

No duplicate sensor identifiers returned by the library.

Notes

If this is by design and consumers are expected to handle duplicates, it would be helpful to document that in the library.

Error itself

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at LibreHardwareMonitor.UI.MainForm.GetPcInfo()
   at LibreHardwareMonitor.UI.MainForm.Timer_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9345.0 built by: NET481REL1LAST_25H2_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
CPU COOLER V5.0
    Assembly Version: 0.9.1.0
    Win32 Version: 0.9.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/CPU%20COOLER%20V5.0.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9325.0 built by: NET481REL1LAST_25H2_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9340.0 built by: NET481REL1LAST_25H2_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9221.0 built by: NET481REL1LAST_25H2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Aga.Controls
    Assembly Version: 1.7.0.0
    Win32 Version: 1.7.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/Aga.Controls.DLL
----------------------------------------
LibreHardwareMonitorLib
    Assembly Version: 0.9.5.0
    Win32 Version: 0.9.5.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/LibreHardwareMonitorLib.DLL
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9347.0 built by: NET481REL1LAST_25H2_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Microsoft.Win32.TaskScheduler
    Assembly Version: 2.10.1.0
    Win32 Version: 2.10.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/Microsoft.Win32.TaskScheduler.DLL
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9340.0 built by: NET481REL1LAST_25H2_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9221.0 built by: NET481REL1LAST_25H2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9221.0 built by: NET481REL1LAST_25H2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
OxyPlot
    Assembly Version: 2.1.2.0
    Win32 Version: 2.1.2.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/OxyPlot.DLL
----------------------------------------
OxyPlot.WindowsForms
    Assembly Version: 2.1.2.0
    Win32 Version: 2.1.2.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/OxyPlot.WindowsForms.DLL
----------------------------------------
System.Configuration.Install
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9221.0 built by: NET481REL1LAST_25H2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration.Install/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.Install.dll
----------------------------------------
fgxjy4kf
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.9340.0 built by: NET481REL1LAST_25H2_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
RAMSPDToolkit-NDD
    Assembly Version: 1.3.2.0
    Win32 Version: 1.3.2
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/RAMSPDToolkit-NDD.DLL
----------------------------------------
HidSharp
    Assembly Version: 2.1.0.0
    Win32 Version: 2.1.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/CPU%20COOLER%20V5.0/HidSharp.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Since i didnt find a way to report to CPU COOLER itself im bringing it here too cuz its related.

Source: LibreHardwareMonitor/LibreHardwareMonitor