Skip to content

Kowismo/trafficmonitor-hardwaremonitor-fix

Repository files navigation

TrafficMonitor LibreHardwareMonitor dependency fix

🪟 If you update LibreHardwareMonitorLib.dll in the TrafficMonitor install folder (often done to avoid Windows Defender “vulnerable driver” blocks), you may run into plugin/app startup crashes like:

  • System.Memory, Version=4.0.5.0 ... could not be found
  • DiskInfoToolkit, Version=1.1.0.0 ... could not be found

Reason: newer LibreHardwareMonitorLib versions pull additional managed dependencies which are not shipped with TrafficMonitor by default.

Where to get LibreHardwareMonitorLib.dll

By default, you provide LibreHardwareMonitorLib.dll, and the script deploys the missing dependencies it references.

Recommended sources:

  1. Official LibreHardwareMonitor releases (recommended)

  2. Build LibreHardwareMonitor yourself (advanced)

Important: copy LibreHardwareMonitorLib.dll into the TrafficMonitor install folder (same folder as TrafficMonitor.exe). The script expects it at:

<TrafficMonitorDir>\\LibreHardwareMonitorLib.dll

Pinned LibreHardwareMonitorLib.dll (0.9.4)

This repo also contains an optional pinned LibreHardwareMonitorLib.dll (AssemblyVersion 0.9.4.0) here:

  • pinned/LHM_0.9.4/LibreHardwareMonitorLib.dll

If you want the script to copy that pinned DLL into your TrafficMonitor folder first, run:

powershell -NoProfile -ExecutionPolicy Bypass -File .\deploy_tm_deps.ps1 -TrafficMonitorDir "C:\Path\To\TrafficMonitor" -LibreHardwareMonitorLibSource ".\pinned\LHM_0.9.4\LibreHardwareMonitorLib.dll"

License for the bundled pinned DLL is included at:

  • pinned/LHM_0.9.4/LICENSE.LibreHardwareMonitor.txt

Example error dialogs

These are the typical errors you see when LibreHardwareMonitorLib.dll was updated but the referenced managed dependencies were not deployed into the TrafficMonitor folder yet:

System.Memory missing

System.Memory missing

Typical message (DE):

Die Datei oder Assembly "System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" oder eine Abhängigkeit davon wurde nicht gefunden.

English:

The file or assembly "System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" or one of its dependencies could not be found.

DiskInfoToolkit missing

DiskInfoToolkit missing

Typical message (DE):

Die Datei oder Assembly "DiskInfoToolkit, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden.

English:

The file or assembly "DiskInfoToolkit, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null" or one of its dependencies could not be found.

What changed

The helper script deploy_tm_deps.ps1 was added to:

  1. detect which assemblies LibreHardwareMonitorLib.dll references
  2. download the matching DLLs from NuGet
  3. copy them into the TrafficMonitor install folder
  4. create/update TrafficMonitor.exe.config with binding redirects when exact assembly versions are not available via NuGet

The script creates .bak.YYYYMMDDHHmmss backups for any file it overwrites.

How to use

Run PowerShell (Administrator may be required if TrafficMonitor is installed under Program Files) and execute.

Replace C:\\Path\\To\\TrafficMonitor with your actual TrafficMonitor install directory.

powershell -NoProfile -ExecutionPolicy Bypass -File .\deploy_tm_deps.ps1 -TrafficMonitorDir "C:\Path\To\TrafficMonitor"

Files that are typically added to the TrafficMonitor folder

Depending on your LibreHardwareMonitorLib.dll version, these can be added:

  • HidSharp.dll
  • System.Memory.dll
  • System.Buffers.dll
  • System.Numerics.Vectors.dll
  • System.Runtime.CompilerServices.Unsafe.dll
  • DiskInfoToolkit.dll
  • BlackSharp.Core.dll
  • RAMSPDToolkit-NDD.dll

and TrafficMonitor.exe.config (binding redirects).