From 823e467078dca775efdf1aee5ece539d9bf2f397 Mon Sep 17 00:00:00 2001 From: Phoenix Date: Thu, 7 Aug 2025 02:39:54 +0800 Subject: [PATCH] Add start-service.bat script for Resource Monitor Service v2.0 - Introduced a batch script to simplify the startup process for the Resource Monitor Service. - Included checks for .NET 9.0 Runtime installation. - Added build and run commands for the service with appropriate error handling. - Provided user instructions and API documentation links in the script output. --- Configuration/MonitoringSettings.cs | 69 + Models/SystemInfo.cs | 170 + Program.cs | 46 +- README.md | 41 +- README_v2.md | 248 + ResourceMonitorService.csproj | 4 + Services/AlertService.cs | 301 ++ Services/GameDetectionService.cs | 416 ++ Services/ResourceMonitorService.cs | 668 +++ Services/SystemInfoService.cs | 217 + Worker.cs | 745 +-- WorkerNew.cs | 387 ++ appsettings.json | 77 +- install-service.ps1 | 193 + install-service.sh | 86 + logs/resourcemonitor-20250807.txt | 7073 +++++++++++++++++++++++++++ start-service.bat | 41 + 17 files changed, 10419 insertions(+), 363 deletions(-) create mode 100644 Configuration/MonitoringSettings.cs create mode 100644 Models/SystemInfo.cs create mode 100644 README_v2.md create mode 100644 Services/AlertService.cs create mode 100644 Services/GameDetectionService.cs create mode 100644 Services/ResourceMonitorService.cs create mode 100644 Services/SystemInfoService.cs create mode 100644 WorkerNew.cs create mode 100644 install-service.ps1 create mode 100644 install-service.sh create mode 100644 logs/resourcemonitor-20250807.txt create mode 100644 start-service.bat diff --git a/Configuration/MonitoringSettings.cs b/Configuration/MonitoringSettings.cs new file mode 100644 index 0000000..d6a5a87 --- /dev/null +++ b/Configuration/MonitoringSettings.cs @@ -0,0 +1,69 @@ +namespace ResourceMonitorService.Configuration +{ + public class MonitoringSettings + { + public int UpdateIntervalMs { get; set; } = 5000; // 5 seconds + public int DataRetentionDays { get; set; } = 7; + public bool EnableGpuMonitoring { get; set; } = true; + public bool EnableDiskMonitoring { get; set; } = true; + public bool EnableNetworkMonitoring { get; set; } = true; + public bool EnableTemperatureMonitoring { get; set; } = true; + public bool EnableProcessMonitoring { get; set; } = true; + public bool EnableGameDetection { get; set; } = true; + public bool EnableAlerts { get; set; } = true; + public int MaxProcessesToTrack { get; set; } = 10; + public int MaxHistoryPoints { get; set; } = 1000; + + public List GamePlatformPaths { get; set; } = new() + { + @"\steamapps\common\", + @"\Epic Games\", + @"\GOG Galaxy\Games\", + @"\Origin Games\", + @"\Ubisoft Game Launcher\games\" + }; + + public List AlertThresholds { get; set; } = new() + { + new() { Component = "CPU", WarningThreshold = 80, CriticalThreshold = 95, DurationSeconds = 30 }, + new() { Component = "Memory", WarningThreshold = 85, CriticalThreshold = 95, DurationSeconds = 30 }, + new() { Component = "GPU", WarningThreshold = 85, CriticalThreshold = 95, DurationSeconds = 30 }, + new() { Component = "CPUTemp", WarningThreshold = 75, CriticalThreshold = 85, DurationSeconds = 60 }, + new() { Component = "GPUTemp", WarningThreshold = 80, CriticalThreshold = 90, DurationSeconds = 60 } + }; + } + + public class AlertThresholdConfig + { + public string Component { get; set; } = string.Empty; + public float WarningThreshold { get; set; } + public float CriticalThreshold { get; set; } + public int DurationSeconds { get; set; } = 30; + public bool IsEnabled { get; set; } = true; + } + + public class ApiSettings + { + public string ApiKey { get; set; } = string.Empty; + public bool RequireApiKey { get; set; } = false; + public List AllowedOrigins { get; set; } = new() + { + "http://localhost:4200", + "http://192.168.50.52:4200", + "http://vmwin11:4200" + }; + public bool EnableSwagger { get; set; } = false; + public string BasePath { get; set; } = "/api"; + } + + public class LoggingSettings + { + public string LogLevel { get; set; } = "Information"; + public string LogPath { get; set; } = "logs"; + public int MaxLogFiles { get; set; } = 30; + public long MaxLogFileSizeMB { get; set; } = 10; + public bool EnableFileLogging { get; set; } = true; + public bool EnableConsoleLogging { get; set; } = true; + public bool EnablePerformanceLogging { get; set; } = false; + } +} diff --git a/Models/SystemInfo.cs b/Models/SystemInfo.cs new file mode 100644 index 0000000..b585544 --- /dev/null +++ b/Models/SystemInfo.cs @@ -0,0 +1,170 @@ +using System.ComponentModel.DataAnnotations; + +namespace ResourceMonitorService.Models +{ + public class SystemInfo + { + public string MachineName { get; set; } = string.Empty; + public string OSVersion { get; set; } = string.Empty; + public string OSArchitecture { get; set; } = string.Empty; + public int ProcessorCount { get; set; } + public ulong TotalPhysicalMemory { get; set; } + public string CPUName { get; set; } = string.Empty; + public DateTime BootTime { get; set; } + public TimeSpan Uptime { get; set; } + public string Domain { get; set; } = string.Empty; + public bool IsVirtualMachine { get; set; } + public string HypervisorVendor { get; set; } = string.Empty; + } + + public class ResourceUsage + { + public DateTime Timestamp { get; set; } + public CpuUsage CPU { get; set; } = new(); + public MemoryUsage Memory { get; set; } = new(); + public GpuUsage GPU { get; set; } = new(); + public List Disks { get; set; } = new(); + public NetworkUsage Network { get; set; } = new(); + public List TopProcesses { get; set; } = new(); + public TemperatureInfo Temperature { get; set; } = new(); + public GameInfo? RunningGame { get; set; } + } + + public class CpuUsage + { + public float Usage { get; set; } + public float[] CoreUsages { get; set; } = Array.Empty(); + public float Temperature { get; set; } + public float MaxFrequency { get; set; } + public float CurrentFrequency { get; set; } + public bool IsThrottling { get; set; } + } + + public class MemoryUsage + { + public float UsagePercentage { get; set; } + public ulong UsedMemory { get; set; } + public ulong AvailableMemory { get; set; } + public ulong TotalMemory { get; set; } + public ulong CommittedMemory { get; set; } + public ulong PagedMemory { get; set; } + public ulong NonPagedMemory { get; set; } + } + + public class GpuUsage + { + public uint Usage { get; set; } + public uint MemoryUsage { get; set; } + public uint Temperature { get; set; } + public uint FanSpeed { get; set; } + public uint PowerUsage { get; set; } + public ulong MemoryTotal { get; set; } + public ulong MemoryUsed { get; set; } + public bool IsAvailable { get; set; } + public string Error { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string DriverVersion { get; set; } = string.Empty; + } + + public class DiskUsage + { + public string DriveLetter { get; set; } = string.Empty; + public string Label { get; set; } = string.Empty; + public string FileSystem { get; set; } = string.Empty; + public ulong TotalSize { get; set; } + public ulong FreeSpace { get; set; } + public ulong UsedSpace { get; set; } + public float UsagePercentage { get; set; } + public float ReadSpeed { get; set; } // MB/s + public float WriteSpeed { get; set; } // MB/s + public float DiskTime { get; set; } // % disk time + public uint Temperature { get; set; } + public bool IsSSD { get; set; } + public long ReadOperations { get; set; } + public long WriteOperations { get; set; } + } + + public class NetworkUsage + { + public float UploadSpeed { get; set; } // MB/s + public float DownloadSpeed { get; set; } // MB/s + public ulong BytesSent { get; set; } + public ulong BytesReceived { get; set; } + public List Adapters { get; set; } = new(); + } + + public class NetworkAdapter + { + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public bool IsOperational { get; set; } + public long Speed { get; set; } + public float UploadSpeed { get; set; } + public float DownloadSpeed { get; set; } + public string IPAddress { get; set; } = string.Empty; + public string MACAddress { get; set; } = string.Empty; + } + + public class ProcessInfo + { + public int Id { get; set; } + public string Name { get; set; } = string.Empty; + public float CpuUsage { get; set; } + public ulong MemoryUsage { get; set; } + public TimeSpan ProcessorTime { get; set; } + public DateTime StartTime { get; set; } + public string ExecutablePath { get; set; } = string.Empty; + public string CommandLine { get; set; } = string.Empty; + } + + public class TemperatureInfo + { + public float CPU { get; set; } + public float GPU { get; set; } + public float Motherboard { get; set; } + public List HardDrives { get; set; } = new(); + } + + public class HardDriveTemp + { + public string Drive { get; set; } = string.Empty; + public float Temperature { get; set; } + public string Health { get; set; } = string.Empty; + } + + public class GameInfo + { + public string GameName { get; set; } = string.Empty; + public string ExecutableName { get; set; } = string.Empty; + public string FullPath { get; set; } = string.Empty; + public int ProcessId { get; set; } + public ulong MemoryUsage { get; set; } + public TimeSpan CpuTime { get; set; } + public DateTime StartTime { get; set; } + public string Platform { get; set; } = string.Empty; // Steam, Epic, etc. + public bool IsFullscreen { get; set; } + public float FPS { get; set; } + } + + public class AlertThreshold + { + public string Name { get; set; } = string.Empty; + public string Component { get; set; } = string.Empty; // CPU, Memory, GPU, Disk, Network + public float WarningThreshold { get; set; } + public float CriticalThreshold { get; set; } + public bool IsEnabled { get; set; } + public TimeSpan Duration { get; set; } // How long the threshold must be exceeded + } + + public class Alert + { + public DateTime Timestamp { get; set; } + public string Component { get; set; } = string.Empty; + public string Level { get; set; } = string.Empty; // Warning, Critical + public string Message { get; set; } = string.Empty; + public float CurrentValue { get; set; } + public float ThresholdValue { get; set; } + public bool IsResolved { get; set; } + public DateTime? ResolvedAt { get; set; } + } +} diff --git a/Program.cs b/Program.cs index ad226d1..cbcea26 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,9 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Configuration; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Services; +using Serilog; using System.Diagnostics; namespace ResourceMonitorService @@ -8,20 +12,58 @@ namespace ResourceMonitorService { public static void Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + // Configure Serilog early + Log.Logger = new LoggerConfiguration() + .WriteTo.Console() + .WriteTo.File("logs/resourcemonitor-.txt", rollingInterval: RollingInterval.Day) + .CreateLogger(); + + try + { + Log.Information("Starting Resource Monitor Service"); + CreateHostBuilder(args).Build().Run(); + } + catch (Exception ex) + { + Log.Fatal(ex, "Application start-up failed"); + } + finally + { + Log.CloseAndFlush(); + } } public static IHostBuilder CreateHostBuilder(string[] args) { var builder = Host.CreateDefaultBuilder(args) + .UseSerilog() .ConfigureServices((hostContext, services) => { + // Bind configuration sections + services.Configure( + hostContext.Configuration.GetSection("MonitoringSettings")); + services.Configure( + hostContext.Configuration.GetSection("ApiSettings")); + services.Configure( + hostContext.Configuration.GetSection("LoggingSettings")); + + // Register services + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + + // Register the main worker service services.AddHostedService(); }); + // Configure as Windows Service if requested if (args.Contains("--windows-service") || Environment.GetEnvironmentVariable("RUN_AS_SERVICE") == "true") { - builder.UseWindowsService(); + builder.UseWindowsService(options => + { + options.ServiceName = "ResourceMonitorService"; + }); } return builder; diff --git a/README.md b/README.md index 12fbfe1..708caff 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,40 @@ -# Resource Usage API +# Resource Monitor Service v2.0 -This project is a background service developed using ASP.NET Core that monitors system resource usage, such as CPU, RAM, GPU, and running games. The service provides APIs to fetch the current resource usage and kill specified processes. +A comprehensive Windows VM monitoring service designed specifically for Unraid virtual machines. This service provides real-time system monitoring, alerting, and remote management capabilities through a REST API. -## Features +## 🚀 New Features in v2.0 -- **Resource Monitoring**: Fetches detailed information about the system's resources, including: - - Current Time - - Computer Information (Machine Name, OS Version, Architecture, Processor Count) - - CPU Usage +### Enhanced Monitoring +- **Multi-core CPU monitoring** with per-core usage and frequency tracking +- **Advanced memory monitoring** including paged/non-paged memory +- **Enhanced GPU monitoring** with NVIDIA GPU support via NVML +- **Comprehensive disk monitoring** with I/O performance metrics +- **Network monitoring** with per-adapter statistics +- **Temperature monitoring** for CPU, GPU, and storage devices +- **Process monitoring** with detailed resource usage tracking + +### VM-Specific Features +- **Hypervisor detection** (VMware, Hyper-V, QEMU/KVM, etc.) +- **VM information** including boot time and uptime tracking +- **Virtual machine optimization** for better performance in virtualized environments + +### Game Detection & Management +- **Multi-platform game detection** (Steam, Epic Games, GOG, Origin, Ubisoft) +- **Fullscreen detection** for gaming sessions +- **Game performance monitoring** with memory and CPU usage +- **Enhanced process management** with graceful termination options + +### Intelligent Alerting System +- **Configurable thresholds** for CPU, memory, GPU, and temperature +- **Duration-based alerting** to prevent false positives +- **Alert history** and active alert management +- **Automatic alert resolution** when conditions improve + +### Improved API +- **RESTful endpoints** with structured responses +- **Enhanced error handling** and logging +- **Configurable CORS** and API key authentication +- **Health check endpoints** for monitoring service status - RAM Usage - GPU Usage - Currently Running Steam Games (if any) diff --git a/README_v2.md b/README_v2.md new file mode 100644 index 0000000..e046117 --- /dev/null +++ b/README_v2.md @@ -0,0 +1,248 @@ +# Resource Monitor Service for Unraid VM + +A comprehensive system monitoring service specifically designed for Windows VMs running on Unraid servers. This service provides real-time monitoring of CPU, memory, GPU, disk, network, and system resources through a RESTful API. + +## 🚀 Features + +### Core Monitoring +- **CPU Monitoring**: Per-core usage, frequency, temperature, and throttling detection +- **Memory Monitoring**: RAM usage, available memory, committed memory, and paging +- **GPU Monitoring**: NVIDIA GPU usage, memory, temperature (via NVML) +- **Disk Monitoring**: I/O statistics, space usage, and performance counters +- **Network Monitoring**: Bandwidth usage, packet statistics, and interface data +- **Temperature Monitoring**: CPU and hard drive temperature sensors + +### VM-Specific Features +- **VM Detection**: Automatically detects virtualization environment +- **Hypervisor Identification**: Identifies VMware, VirtualBox, Hyper-V, KVM, etc. +- **Unraid Optimization**: Optimized for Unraid VM environments +- **Resource Alerting**: Configurable thresholds for resource usage alerts + +### Advanced Features +- **Game Detection**: Multi-platform game detection with fullscreen monitoring +- **Process Management**: View top processes, terminate processes via API +- **Smart Alerting**: Duration-based alerting to prevent false positives +- **System Control**: Remote shutdown/restart capabilities +- **Health Monitoring**: Comprehensive health checks and uptime tracking + +## 📡 API Endpoints + +The service runs on `http://localhost:5000` by default and provides the following endpoints: + +### System Information +- `GET /api/system-info` - Complete system information including VM details +- `GET /api/vm/info` - VM-specific information (hypervisor, uptime, etc.) +- `GET /api/health` - Service health status and monitoring capabilities +- `GET /api/metrics` - Service metrics and performance overview +- `GET /api/config` - Current configuration settings + +### Resource Monitoring +- `GET /api/resource-usage` - Complete resource usage overview +- `GET /api/cpu-usage` - Detailed CPU metrics with per-core data +- `GET /api/memory-usage` - Memory utilization and statistics +- `GET /api/gpu-usage` - GPU usage, memory, and temperature +- `GET /api/disk-usage` - Disk I/O and space usage for all drives +- `GET /api/network-usage` - Network interface statistics +- `GET /api/top-processes?count=10` - Top processes by CPU/memory usage + +### Game Detection +- `GET /api/current-game` - Currently running game information +- `GET /api/all-games` - All detected games on the system +- `GET /api/fullscreen-status` - Check if any game is running fullscreen + +### Alerting System +- `GET /api/alerts/active` - Currently active alerts +- `GET /api/alerts/history?count=100` - Alert history +- `POST /api/alerts/{alertId}/resolve` - Manually resolve an alert +- `GET /api/alerts/enabled` - Check if alerting is enabled + +### System Control +- `POST /api/process/kill` - Terminate a process (requires process ID and optional force flag) +- `POST /api/system/shutdown` - Shutdown, restart, or cancel system operations +- `POST /api/service/stop` - Stop the monitoring service + +## 🛠️ Installation & Usage + +### Option 1: Console Application (Development/Testing) +```powershell +cd C:\Work\DEV\ResourceUsageAPI +dotnet run --configuration Release +``` + +### Option 2: Windows Service (Production) +```powershell +# Run as Administrator +cd C:\Work\DEV\ResourceUsageAPI\publish +.\install-service.bat +``` + +### Option 3: Standalone Executable +```powershell +cd C:\Work\DEV\ResourceUsageAPI\publish +.\ResourceMonitorService.exe +``` + +## ⚙️ Configuration + +Configuration is managed through `appsettings.json`: + +```json +{ + "MonitoringSettings": { + "UpdateIntervalMs": 5000, + "EnableGpuMonitoring": true, + "EnableDiskMonitoring": true, + "EnableNetworkMonitoring": true, + "EnableTemperatureMonitoring": true, + "EnableProcessMonitoring": true, + "EnableGameDetection": true, + "EnableAlerts": true + }, + "AlertThresholds": { + "CpuUsageThreshold": 80.0, + "MemoryUsageThreshold": 85.0, + "GpuUsageThreshold": 90.0, + "DiskUsageThreshold": 90.0, + "TemperatureThreshold": 80.0, + "AlertDurationSeconds": 30 + }, + "ApiSettings": { + "RequireApiKey": false, + "AllowedOrigins": ["http://localhost:4200", "http://unraid:4200"], + "BasePath": "/api" + } +} +``` + +## 📊 Example API Responses + +### Health Check +```json +{ + "status": "Healthy", + "timestamp": "2025-08-07T02:30:00Z", + "uptime": "1.16:55:30", + "activeAlerts": 0, + "monitoringEnabled": { + "gpu": true, + "disk": true, + "network": true, + "temperature": true, + "processes": true, + "games": true, + "alerts": true + } +} +``` + +### CPU Usage +```json +{ + "usage": 15.5, + "coreUsages": [12.1, 18.3, 14.7, 16.2], + "temperature": 65.0, + "maxFrequency": 4400, + "currentFrequency": 3200, + "isThrottling": false +} +``` + +### VM Information +```json +{ + "isVirtualMachine": true, + "hypervisorVendor": "VMware", + "uptime": "1.16:55:30", + "bootTime": "2025-08-05T09:34:04Z", + "machineName": "WIN11-VM", + "domain": "WORKGROUP" +} +``` + +## 🔧 PowerShell Usage Examples + +```powershell +# Get system health +$health = Invoke-RestMethod -Uri "http://localhost:5000/api/health" +Write-Host "System Status: $($health.status)" + +# Get CPU usage +$cpu = Invoke-RestMethod -Uri "http://localhost:5000/api/cpu-usage" +Write-Host "CPU Usage: $($cpu.usage)%" + +# Get current game +$game = Invoke-RestMethod -Uri "http://localhost:5000/api/current-game" +if ($game.isGameRunning) { + Write-Host "Currently playing: $($game.gameName)" +} + +# Shutdown system with 60-second delay +$shutdownRequest = @{ + Action = "shutdown" + DelaySeconds = 60 + Message = "Scheduled maintenance shutdown" +} | ConvertTo-Json + +Invoke-RestMethod -Uri "http://localhost:5000/api/system/shutdown" -Method Post -Body $shutdownRequest -ContentType "application/json" +``` + +## 🚨 Known Warnings (Non-Critical) + +The service may show warnings in VM environments that don't affect functionality: + +- **Performance Counter Warnings**: Some performance counters may not be available in VMs +- **Temperature Sensor Access**: Some temperature sensors require elevated privileges +- **Process Access Denied**: Some system processes require elevated privileges to access +- **Windows.Forms Compatibility**: Game detection works despite .NET Framework compatibility warnings + +These warnings are expected in VM environments and the service continues to function normally. + +## 🎯 Perfect for Unraid + +This service is specifically optimized for Windows VMs running on Unraid: + +- **VM Detection**: Automatically detects and reports virtualization status +- **Resource Monitoring**: Tracks VM resource allocation and usage +- **Gaming Support**: Detects games and monitors performance impact +- **Remote Management**: Full API control for integration with Unraid dashboard +- **Alert System**: Configurable alerts for resource thresholds +- **Health Monitoring**: Comprehensive health checks for VM status + +## 📝 Logging + +The service uses Serilog for structured logging: +- Console output for real-time monitoring +- File logging for persistent records +- Configurable log levels (Debug, Information, Warning, Error) +- Smart error suppression to prevent log spam in VM environments + +## 🔐 Security + +- Optional API key authentication +- CORS support for web dashboard integration +- Process termination requires explicit API calls +- System shutdown/restart requires explicit API calls +- Configurable allowed origins for API access + +## 📈 Performance + +- Lightweight background monitoring (5-second intervals by default) +- Efficient memory usage with smart caching +- Non-blocking async operations +- Graceful error handling for VM-specific limitations +- Configurable monitoring intervals and features + +## 🆘 Support + +For issues or questions: +1. Check the console output for warnings/errors +2. Review the configuration in `appsettings.json` +3. Test individual API endpoints using PowerShell or curl +4. Check Windows Event Logs if running as a service + +--- + +**Version**: 2.0.0 +**Target Framework**: .NET 9.0 +**Platforms**: Windows (VM optimized) +**License**: Open Source diff --git a/ResourceMonitorService.csproj b/ResourceMonitorService.csproj index 7615f84..63f0c4b 100644 --- a/ResourceMonitorService.csproj +++ b/ResourceMonitorService.csproj @@ -13,5 +13,9 @@ + + + + diff --git a/Services/AlertService.cs b/Services/AlertService.cs new file mode 100644 index 0000000..6b6adc7 --- /dev/null +++ b/Services/AlertService.cs @@ -0,0 +1,301 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using System.Collections.Concurrent; + +namespace ResourceMonitorService.Services +{ + public interface IAlertService + { + Task CheckAndGenerateAlertsAsync(ResourceUsage resourceUsage); + Task> GetActiveAlertsAsync(); + Task> GetAlertHistoryAsync(int count = 100); + Task ResolveAlertAsync(string alertId); + Task IsAlertingEnabledAsync(); + event EventHandler? AlertTriggered; + event EventHandler? AlertResolved; + } + + public class AlertService : IAlertService + { + private readonly ILogger _logger; + private readonly MonitoringSettings _settings; + private readonly ConcurrentDictionary _activeAlerts; + private readonly ConcurrentQueue _alertHistory; + private readonly Dictionary _lastAlertTime; + private readonly Dictionary _thresholdExceededTime; + + public event EventHandler? AlertTriggered; + public event EventHandler? AlertResolved; + + public AlertService(ILogger logger, IOptions settings) + { + _logger = logger; + _settings = settings.Value; + _activeAlerts = new ConcurrentDictionary(); + _alertHistory = new ConcurrentQueue(); + _lastAlertTime = new Dictionary(); + _thresholdExceededTime = new Dictionary(); + } + + public async Task CheckAndGenerateAlertsAsync(ResourceUsage resourceUsage) + { + if (!_settings.EnableAlerts) + return; + + try + { + await Task.Run(() => + { + // Check CPU usage + CheckThreshold("CPU", resourceUsage.CPU.Usage, "CPU Usage", "%"); + + // Check CPU temperature + if (resourceUsage.CPU.Temperature > 0) + CheckThreshold("CPUTemp", resourceUsage.CPU.Temperature, "CPU Temperature", "°C"); + + // Check Memory usage + CheckThreshold("Memory", resourceUsage.Memory.UsagePercentage, "Memory Usage", "%"); + + // Check GPU usage + if (resourceUsage.GPU.IsAvailable) + { + CheckThreshold("GPU", resourceUsage.GPU.Usage, "GPU Usage", "%"); + if (resourceUsage.GPU.Temperature > 0) + CheckThreshold("GPUTemp", resourceUsage.GPU.Temperature, "GPU Temperature", "°C"); + } + + // Check disk usage + foreach (var disk in resourceUsage.Disks) + { + CheckThreshold($"Disk_{disk.DriveLetter}", disk.UsagePercentage, + $"Disk Usage ({disk.DriveLetter})", "%"); + + if (disk.DiskTime > 0) + CheckThreshold($"DiskTime_{disk.DriveLetter}", disk.DiskTime, + $"Disk Time ({disk.DriveLetter})", "%"); + } + + // Check for processes using too much memory + var topMemoryProcess = resourceUsage.TopProcesses + .OrderByDescending(p => p.MemoryUsage) + .FirstOrDefault(); + + if (topMemoryProcess != null) + { + var memoryUsageGB = topMemoryProcess.MemoryUsage / (1024.0 * 1024.0 * 1024.0); + if (memoryUsageGB > 4) // Alert if a single process is using more than 4GB + { + CheckCustomAlert($"ProcessMemory_{topMemoryProcess.Name}", + (float)memoryUsageGB, 4f, 8f, + $"High Memory Usage - {topMemoryProcess.Name}", "GB"); + } + } + + // Resolve alerts that are no longer active + ResolveInactiveAlerts(resourceUsage); + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error checking and generating alerts"); + } + } + + private void CheckThreshold(string component, float currentValue, string description, string unit) + { + var threshold = _settings.AlertThresholds.FirstOrDefault(t => + t.Component.Equals(component, StringComparison.OrdinalIgnoreCase)); + + if (threshold == null || !threshold.IsEnabled) + return; + + CheckCustomAlert(component, currentValue, threshold.WarningThreshold, + threshold.CriticalThreshold, description, unit, TimeSpan.FromSeconds(threshold.DurationSeconds)); + } + + private void CheckCustomAlert(string component, float currentValue, float warningThreshold, + float criticalThreshold, string description, string unit, TimeSpan? duration = null) + { + var alertDuration = duration ?? TimeSpan.FromSeconds(30); + var now = DateTime.Now; + + // Determine alert level + string? alertLevel = null; + float thresholdValue = 0; + + if (currentValue >= criticalThreshold) + { + alertLevel = "Critical"; + thresholdValue = criticalThreshold; + } + else if (currentValue >= warningThreshold) + { + alertLevel = "Warning"; + thresholdValue = warningThreshold; + } + + if (alertLevel != null) + { + // Check if threshold has been exceeded for the required duration + var key = $"{component}_{alertLevel}"; + + if (!_thresholdExceededTime.ContainsKey(key)) + { + _thresholdExceededTime[key] = now; + return; // Not exceeded long enough yet + } + + var exceededDuration = now - _thresholdExceededTime[key]; + if (exceededDuration < alertDuration) + return; // Not exceeded long enough yet + + // Check if we've already sent this alert recently (avoid spam) + if (_lastAlertTime.TryGetValue(key, out var lastAlert)) + { + if (now - lastAlert < TimeSpan.FromMinutes(5)) + return; // Too soon since last alert + } + + // Create and trigger alert + var alert = new Alert + { + Timestamp = now, + Component = component, + Level = alertLevel, + Message = $"{description} is {alertLevel.ToLower()}: {currentValue:F1}{unit} (threshold: {thresholdValue:F1}{unit})", + CurrentValue = currentValue, + ThresholdValue = thresholdValue, + IsResolved = false + }; + + var alertId = $"{component}_{alertLevel}_{now:yyyyMMddHHmmss}"; + _activeAlerts[alertId] = alert; + _alertHistory.Enqueue(alert); + _lastAlertTime[key] = now; + + // Trim history if too large + while (_alertHistory.Count > 1000) + { + _alertHistory.TryDequeue(out _); + } + + _logger.LogWarning("Alert triggered: {Message}", alert.Message); + AlertTriggered?.Invoke(this, alert); + } + else + { + // Value is below threshold, remove tracking + var warningKey = $"{component}_Warning"; + var criticalKey = $"{component}_Critical"; + _thresholdExceededTime.Remove(warningKey); + _thresholdExceededTime.Remove(criticalKey); + } + } + + private void ResolveInactiveAlerts(ResourceUsage resourceUsage) + { + var now = DateTime.Now; + var alertsToResolve = new List(); + + foreach (var activeAlert in _activeAlerts) + { + var alert = activeAlert.Value; + var shouldResolve = false; + + // Check if the condition that triggered the alert is no longer true + switch (alert.Component) + { + case "CPU": + shouldResolve = resourceUsage.CPU.Usage < alert.ThresholdValue; + break; + case "CPUTemp": + shouldResolve = resourceUsage.CPU.Temperature < alert.ThresholdValue; + break; + case "Memory": + shouldResolve = resourceUsage.Memory.UsagePercentage < alert.ThresholdValue; + break; + case "GPU": + shouldResolve = !resourceUsage.GPU.IsAvailable || resourceUsage.GPU.Usage < alert.ThresholdValue; + break; + case "GPUTemp": + shouldResolve = !resourceUsage.GPU.IsAvailable || resourceUsage.GPU.Temperature < alert.ThresholdValue; + break; + default: + // For disk alerts and others, check if component still exists and is below threshold + if (alert.Component.StartsWith("Disk_")) + { + var driveLetter = alert.Component.Replace("Disk_", "").Replace("DiskTime_", ""); + var disk = resourceUsage.Disks.FirstOrDefault(d => d.DriveLetter.Contains(driveLetter)); + if (disk != null) + { + shouldResolve = alert.Component.StartsWith("DiskTime_") + ? disk.DiskTime < alert.ThresholdValue + : disk.UsagePercentage < alert.ThresholdValue; + } + else + { + shouldResolve = true; // Disk no longer available + } + } + break; + } + + // Auto-resolve old alerts (older than 1 hour) + if (now - alert.Timestamp > TimeSpan.FromHours(1)) + { + shouldResolve = true; + } + + if (shouldResolve) + { + alertsToResolve.Add(activeAlert.Key); + } + } + + // Resolve alerts + foreach (var alertId in alertsToResolve) + { + if (_activeAlerts.TryRemove(alertId, out var resolvedAlert)) + { + resolvedAlert.IsResolved = true; + resolvedAlert.ResolvedAt = now; + + _logger.LogInformation("Alert resolved: {Message}", resolvedAlert.Message); + AlertResolved?.Invoke(this, resolvedAlert); + } + } + } + + public async Task> GetActiveAlertsAsync() + { + return await Task.FromResult(_activeAlerts.Values.ToList()); + } + + public async Task> GetAlertHistoryAsync(int count = 100) + { + return await Task.FromResult(_alertHistory.TakeLast(count).ToList()); + } + + public async Task ResolveAlertAsync(string alertId) + { + await Task.Run(() => + { + if (_activeAlerts.TryRemove(alertId, out var alert)) + { + alert.IsResolved = true; + alert.ResolvedAt = DateTime.Now; + + _logger.LogInformation("Alert manually resolved: {Message}", alert.Message); + AlertResolved?.Invoke(this, alert); + } + }); + } + + public async Task IsAlertingEnabledAsync() + { + return await Task.FromResult(_settings.EnableAlerts); + } + } +} diff --git a/Services/GameDetectionService.cs b/Services/GameDetectionService.cs new file mode 100644 index 0000000..718add7 --- /dev/null +++ b/Services/GameDetectionService.cs @@ -0,0 +1,416 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Text; + +namespace ResourceMonitorService.Services +{ + public interface IGameDetectionService + { + Task GetCurrentlyRunningGameAsync(); + Task> GetAllDetectedGamesAsync(); + Task IsGameRunningFullscreenAsync(); + Task GetGameFpsAsync(string processName); + } + + public class GameDetectionService : IGameDetectionService + { + private readonly ILogger _logger; + private readonly MonitoringSettings _settings; + + // Windows API imports for fullscreen detection + [DllImport("user32.dll")] + private static extern IntPtr GetForegroundWindow(); + + [DllImport("user32.dll")] + private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect); + + [DllImport("user32.dll")] + private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); + + [DllImport("user32.dll")] + private static extern int GetWindowTextLength(IntPtr hWnd); + + [DllImport("user32.dll")] + private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); + + [DllImport("user32.dll")] + private static extern bool IsWindowVisible(IntPtr hWnd); + + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int Left; + public int Top; + public int Right; + public int Bottom; + } + + public GameDetectionService(ILogger logger, IOptions settings) + { + _logger = logger; + _settings = settings.Value; + } + + public async Task GetCurrentlyRunningGameAsync() + { + try + { + return await Task.Run(() => + { + var processes = Process.GetProcesses(); + + foreach (var process in processes) + { + try + { + if (process.MainModule?.FileName == null) + continue; + + var filePath = process.MainModule.FileName; + var gameInfo = DetectGameFromPath(filePath, process); + + if (gameInfo != null) + { + gameInfo.IsFullscreen = IsGameRunningFullscreenAsync().Result; + gameInfo.FPS = GetGameFpsAsync(process.ProcessName).Result; + return gameInfo; + } + } + catch (Exception ex) + { + // Handle access exceptions silently - some processes can't be accessed + _logger.LogTrace(ex, "Could not access process {ProcessName}", process.ProcessName); + } + } + + return null; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error detecting currently running game"); + return null; + } + } + + public async Task> GetAllDetectedGamesAsync() + { + try + { + return await Task.Run(() => + { + var games = new List(); + var processes = Process.GetProcesses(); + + foreach (var process in processes) + { + try + { + if (process.MainModule?.FileName == null) + continue; + + var filePath = process.MainModule.FileName; + var gameInfo = DetectGameFromPath(filePath, process); + + if (gameInfo != null) + { + games.Add(gameInfo); + } + } + catch (Exception ex) + { + _logger.LogTrace(ex, "Could not access process {ProcessName}", process.ProcessName); + } + } + + return games; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting all detected games"); + return new List(); + } + } + + public async Task IsGameRunningFullscreenAsync() + { + try + { + return await Task.Run(() => + { + var foregroundWindow = GetForegroundWindow(); + if (foregroundWindow == IntPtr.Zero) + return false; + + if (!IsWindowVisible(foregroundWindow)) + return false; + + if (!GetWindowRect(foregroundWindow, out RECT rect)) + return false; + + // Get screen dimensions + var screenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; + var screenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; + + // Check if window covers the entire screen + var windowWidth = rect.Right - rect.Left; + var windowHeight = rect.Bottom - rect.Top; + + return windowWidth >= screenWidth && windowHeight >= screenHeight; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not determine if game is running fullscreen"); + return false; + } + } + + public async Task GetGameFpsAsync(string processName) + { + try + { + return await Task.Run(() => + { + // This is a simplified FPS detection - in reality, you'd need more sophisticated methods + // such as hooking into DirectX/OpenGL or using external tools like RTSS + + // For now, we'll return 0 as a placeholder + // In a real implementation, you might: + // 1. Use Windows Performance Toolkit (WPT) ETW events + // 2. Hook into D3D11/D3D12 present calls + // 3. Use NVIDIA's NVAPI or AMD's ADL + // 4. Parse log files from games that output FPS + + return 0f; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get FPS for process {ProcessName}", processName); + return 0f; + } + } + + private GameInfo? DetectGameFromPath(string filePath, Process process) + { + try + { + // Check each configured game platform path + foreach (var platformPath in _settings.GamePlatformPaths) + { + if (filePath.Contains(platformPath, StringComparison.OrdinalIgnoreCase)) + { + var platform = GetPlatformFromPath(platformPath); + var gameName = ExtractGameNameFromPath(filePath, platformPath); + + return new GameInfo + { + GameName = gameName, + ExecutableName = Path.GetFileName(filePath), + FullPath = filePath, + ProcessId = process.Id, + MemoryUsage = (ulong)process.WorkingSet64, + CpuTime = process.TotalProcessorTime, + StartTime = process.StartTime, + Platform = platform, + IsFullscreen = false, // Will be set by caller + FPS = 0f // Will be set by caller + }; + } + } + + // Additional checks for common game launchers and executables + var fileName = Path.GetFileNameWithoutExtension(filePath).ToLowerInvariant(); + var knownGameExecutables = new[] + { + "game", "launcher", "client", "main", "start", "run", + // Add more common game executable patterns + }; + + var gameIndicators = new[] + { + "unreal", "unity", "godot", "gamemaker", "rpgmaker", + "steam", "epic", "origin", "uplay", "battle.net" + }; + + // Check if it's likely a game based on executable name or path + if (knownGameExecutables.Any(exe => fileName.Contains(exe)) || + gameIndicators.Any(indicator => filePath.Contains(indicator, StringComparison.OrdinalIgnoreCase))) + { + // Try to determine platform and game name from other indicators + var platform = DeterminePlatformFromProcess(process, filePath); + var gameName = DetermineGameNameFromProcess(process, filePath); + + if (!string.IsNullOrEmpty(gameName)) + { + return new GameInfo + { + GameName = gameName, + ExecutableName = Path.GetFileName(filePath), + FullPath = filePath, + ProcessId = process.Id, + MemoryUsage = (ulong)process.WorkingSet64, + CpuTime = process.TotalProcessorTime, + StartTime = process.StartTime, + Platform = platform, + IsFullscreen = false, + FPS = 0f + }; + } + } + + return null; + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Error detecting game from path {FilePath}", filePath); + return null; + } + } + + private string GetPlatformFromPath(string platformPath) + { + return platformPath.ToLowerInvariant() switch + { + var path when path.Contains("steamapps") => "Steam", + var path when path.Contains("epic games") => "Epic Games Store", + var path when path.Contains("gog galaxy") => "GOG Galaxy", + var path when path.Contains("origin games") => "EA Origin", + var path when path.Contains("ubisoft game launcher") => "Ubisoft Connect", + _ => "Unknown" + }; + } + + private string ExtractGameNameFromPath(string filePath, string platformPath) + { + try + { + var parts = filePath.Split(new[] { platformPath }, StringSplitOptions.RemoveEmptyEntries); + if (parts.Length > 1) + { + var gamePath = parts[1]; + var gameFolder = gamePath.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries)[0]; + return gameFolder; + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not extract game name from path {FilePath}", filePath); + } + + return Path.GetFileNameWithoutExtension(filePath); + } + + private string DeterminePlatformFromProcess(Process process, string filePath) + { + try + { + // Check parent processes for launcher indicators + var currentProcess = process; + for (int i = 0; i < 3; i++) // Check up to 3 levels up + { + try + { + var parentId = GetParentProcessId(currentProcess.Id); + if (parentId == 0) break; + + var parentProcess = Process.GetProcessById(parentId); + var parentName = parentProcess.ProcessName.ToLowerInvariant(); + + if (parentName.Contains("steam")) + return "Steam"; + if (parentName.Contains("epic")) + return "Epic Games Store"; + if (parentName.Contains("origin")) + return "EA Origin"; + if (parentName.Contains("uplay") || parentName.Contains("ubisoft")) + return "Ubisoft Connect"; + if (parentName.Contains("gog")) + return "GOG Galaxy"; + + currentProcess = parentProcess; + } + catch + { + break; + } + } + + // Fallback: check file path for platform indicators + if (filePath.Contains("Program Files (x86)")) + return "Windows Store/Other"; + if (filePath.Contains("WindowsApps")) + return "Microsoft Store"; + + return "Standalone"; + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not determine platform for process {ProcessName}", process.ProcessName); + return "Unknown"; + } + } + + private string DetermineGameNameFromProcess(Process process, string filePath) + { + try + { + // Try to get a meaningful name from various sources + + // 1. Try from file properties + var versionInfo = FileVersionInfo.GetVersionInfo(filePath); + if (!string.IsNullOrEmpty(versionInfo.ProductName) && + !versionInfo.ProductName.Equals(versionInfo.FileName, StringComparison.OrdinalIgnoreCase)) + { + return versionInfo.ProductName; + } + + // 2. Try from directory name + var directory = Path.GetDirectoryName(filePath); + if (!string.IsNullOrEmpty(directory)) + { + var directoryName = Path.GetFileName(directory); + if (!string.IsNullOrEmpty(directoryName) && + !directoryName.Equals("bin", StringComparison.OrdinalIgnoreCase) && + !directoryName.Equals("exe", StringComparison.OrdinalIgnoreCase)) + { + return directoryName; + } + } + + // 3. Fallback to executable name + return Path.GetFileNameWithoutExtension(filePath); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not determine game name for process {ProcessName}", process.ProcessName); + return process.ProcessName; + } + } + + private int GetParentProcessId(int processId) + { + try + { + using var searcher = new System.Management.ManagementObjectSearcher( + $"SELECT ParentProcessId FROM Win32_Process WHERE ProcessId = {processId}"); + using var collection = searcher.Get(); + foreach (System.Management.ManagementObject obj in collection) + { + return Convert.ToInt32(obj["ParentProcessId"]); + } + } + catch (Exception ex) + { + _logger.LogTrace(ex, "Could not get parent process ID for {ProcessId}", processId); + } + return 0; + } + } +} diff --git a/Services/ResourceMonitorService.cs b/Services/ResourceMonitorService.cs new file mode 100644 index 0000000..053c7b1 --- /dev/null +++ b/Services/ResourceMonitorService.cs @@ -0,0 +1,668 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using System.Diagnostics; +using System.Management; + +namespace ResourceMonitorService.Services +{ + public interface IResourceMonitorService + { + Task GetResourceUsageAsync(); + Task GetCpuUsageAsync(); + Task GetMemoryUsageAsync(); + Task GetGpuUsageAsync(); + Task> GetDiskUsageAsync(); + Task GetNetworkUsageAsync(); + Task> GetTopProcessesAsync(int count = 10); + } + + public class ResourceMonitorService : IResourceMonitorService + { + private readonly ILogger _logger; + private readonly MonitoringSettings _settings; + private readonly Dictionary _counters; + private readonly Dictionary _previousNetworkBytes; + private readonly Dictionary _previousNetworkTime; + + public ResourceMonitorService(ILogger logger, IOptions settings) + { + _logger = logger; + _settings = settings.Value; + _counters = new Dictionary(); + _previousNetworkBytes = new Dictionary(); + _previousNetworkTime = new Dictionary(); + InitializeCounters(); + } + + private void InitializeCounters() + { + try + { +#pragma warning disable CA1416 // Validate platform compatibility + _counters["cpu"] = new PerformanceCounter("Processor", "% Processor Time", "_Total"); + _counters["memory_available"] = new PerformanceCounter("Memory", "Available MBytes"); + + if (_settings.EnableNetworkMonitoring) + { + _counters["network_bytes_sent"] = new PerformanceCounter("Network Interface", "Bytes Sent/sec", "*"); + _counters["network_bytes_received"] = new PerformanceCounter("Network Interface", "Bytes Received/sec", "*"); + } + + if (_settings.EnableDiskMonitoring) + { + _counters["disk_read"] = new PerformanceCounter("PhysicalDisk", "Disk Read Bytes/sec", "_Total"); + _counters["disk_write"] = new PerformanceCounter("PhysicalDisk", "Disk Write Bytes/sec", "_Total"); + _counters["disk_time"] = new PerformanceCounter("PhysicalDisk", "% Disk Time", "_Total"); + } +#pragma warning restore CA1416 // Validate platform compatibility + + // Initialize counters with first reading + foreach (var counter in _counters.Values) + { + try + { + counter.NextValue(); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Failed to initialize performance counter: {CounterName}", counter.CounterName); + } + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to initialize performance counters"); + } + } + + public async Task GetResourceUsageAsync() + { + var timestamp = DateTime.Now; + + var tasks = new List + { + Task.Run(async () => await GetCpuUsageAsync()), + Task.Run(async () => await GetMemoryUsageAsync()) + }; + + if (_settings.EnableGpuMonitoring) + tasks.Add(Task.Run(async () => await GetGpuUsageAsync())); + + if (_settings.EnableDiskMonitoring) + tasks.Add(Task.Run(async () => await GetDiskUsageAsync())); + + if (_settings.EnableNetworkMonitoring) + tasks.Add(Task.Run(async () => await GetNetworkUsageAsync())); + + if (_settings.EnableProcessMonitoring) + tasks.Add(Task.Run(async () => await GetTopProcessesAsync(_settings.MaxProcessesToTrack))); + + await Task.WhenAll(tasks); + + return new ResourceUsage + { + Timestamp = timestamp, + CPU = await GetCpuUsageAsync(), + Memory = await GetMemoryUsageAsync(), + GPU = _settings.EnableGpuMonitoring ? await GetGpuUsageAsync() : new GpuUsage(), + Disks = _settings.EnableDiskMonitoring ? await GetDiskUsageAsync() : new List(), + Network = _settings.EnableNetworkMonitoring ? await GetNetworkUsageAsync() : new NetworkUsage(), + TopProcesses = _settings.EnableProcessMonitoring ? await GetTopProcessesAsync(_settings.MaxProcessesToTrack) : new List(), + Temperature = _settings.EnableTemperatureMonitoring ? await GetTemperatureInfoAsync() : new TemperatureInfo() + }; + } + + public async Task GetCpuUsageAsync() + { + try + { + var temperature = await GetCpuTemperatureAsync(); + + return await Task.Run(() => + { +#pragma warning disable CA1416 // Validate platform compatibility + var usage = _counters.TryGetValue("cpu", out var cpuCounter) ? cpuCounter.NextValue() : 0f; + + // Get per-core usage + var coreUsages = new List(); + for (int i = 0; i < Environment.ProcessorCount; i++) + { + try + { + using var coreCounter = new PerformanceCounter("Processor", "% Processor Time", i.ToString()); + coreCounter.NextValue(); + Thread.Sleep(100); // Small delay for accurate reading + coreUsages.Add(coreCounter.NextValue()); + } + catch + { + coreUsages.Add(0f); + } + } + + // Get CPU frequency + var maxFrequency = 0f; + var currentFrequency = 0f; + try + { + using var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + maxFrequency = Convert.ToSingle(obj["MaxClockSpeed"]); + currentFrequency = Convert.ToSingle(obj["CurrentClockSpeed"]); + break; + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get CPU frequency information"); + } +#pragma warning restore CA1416 // Validate platform compatibility + + return new CpuUsage + { + Usage = usage, + CoreUsages = coreUsages.ToArray(), + MaxFrequency = maxFrequency, + CurrentFrequency = currentFrequency, + IsThrottling = currentFrequency < maxFrequency * 0.9f, // Consider throttling if running below 90% max frequency + Temperature = temperature + }; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting CPU usage"); + return new CpuUsage(); + } + } + + public async Task GetMemoryUsageAsync() + { + try + { + return await Task.Run(() => + { +#pragma warning disable CA1416 // Validate platform compatibility + var availableMemoryMB = _counters.TryGetValue("memory_available", out var memCounter) ? memCounter.NextValue() : 0f; + var availableMemory = (ulong)(availableMemoryMB * 1024 * 1024); + + // Get total memory + var totalMemory = 0UL; + using (var searcher = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem")) + using (var collection = searcher.Get()) + { + foreach (ManagementObject obj in collection) + { + totalMemory = (ulong)obj["TotalPhysicalMemory"]; + break; + } + } + + var usedMemory = totalMemory - availableMemory; + var usagePercentage = totalMemory > 0 ? (float)(usedMemory) / totalMemory * 100 : 0f; + + // Get additional memory info + var committedMemory = 0UL; + var pagedMemory = 0UL; + var nonPagedMemory = 0UL; + + try + { + using var osSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"); + using var osCollection = osSearcher.Get(); + foreach (ManagementObject obj in osCollection) + { + var totalVirtualMemory = (ulong)obj["TotalVirtualMemorySize"] * 1024; + var freeVirtualMemory = (ulong)obj["FreeVirtualMemory"] * 1024; + committedMemory = totalVirtualMemory - freeVirtualMemory; + break; + } + + using var perfSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_PerfRawData_PerfOS_Memory"); + using var perfCollection = perfSearcher.Get(); + foreach (ManagementObject obj in perfCollection) + { + pagedMemory = (ulong)obj["PoolPagedBytes"]; + nonPagedMemory = (ulong)obj["PoolNonpagedBytes"]; + break; + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get extended memory information"); + } +#pragma warning restore CA1416 // Validate platform compatibility + + return new MemoryUsage + { + UsagePercentage = usagePercentage, + UsedMemory = usedMemory, + AvailableMemory = availableMemory, + TotalMemory = totalMemory, + CommittedMemory = committedMemory, + PagedMemory = pagedMemory, + NonPagedMemory = nonPagedMemory + }; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting memory usage"); + return new MemoryUsage(); + } + } + + public async Task GetGpuUsageAsync() + { + try + { + return await Task.Run(() => + { + try + { + NvmlWrapper.NvmlInit(); + IntPtr device; + NvmlWrapper.NvmlDeviceGetHandleByIndex(0, out device); + + NvmlWrapper.NvmlUtilization utilization; + NvmlWrapper.NvmlDeviceGetUtilizationRates(device, out utilization); + + uint temperature; + NvmlWrapper.NvmlDeviceGetTemperature(device, 0, out temperature); + + uint fanSpeed; + NvmlWrapper.NvmlDeviceGetFanSpeed(device, out fanSpeed); + + // Try to get additional information + var name = "NVIDIA GPU"; + var driverVersion = "Unknown"; + var memoryTotal = 0UL; + var memoryUsed = 0UL; + var powerUsage = 0U; + + try + { + // Get GPU name and memory info via WMI as fallback +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController WHERE Name LIKE '%NVIDIA%'"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + name = obj["Name"]?.ToString() ?? name; + driverVersion = obj["DriverVersion"]?.ToString() ?? driverVersion; + if (obj["AdapterRAM"] != null) + { + memoryTotal = (ulong)obj["AdapterRAM"]; + } + break; + } +#pragma warning restore CA1416 // Validate platform compatibility + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get additional GPU information via WMI"); + } + + NvmlWrapper.NvmlShutdown(); + + return new GpuUsage + { + Usage = utilization.Gpu, + MemoryUsage = utilization.Memory, + Temperature = temperature, + FanSpeed = fanSpeed, + PowerUsage = powerUsage, + MemoryTotal = memoryTotal, + MemoryUsed = memoryUsed, + IsAvailable = true, + Name = name, + DriverVersion = driverVersion, + Error = string.Empty + }; + } + catch (Exception ex) + { + return new GpuUsage + { + Usage = 0, + MemoryUsage = 0, + Temperature = 0, + FanSpeed = 0, + PowerUsage = 0, + MemoryTotal = 0, + MemoryUsed = 0, + IsAvailable = false, + Name = "Unknown", + DriverVersion = "Unknown", + Error = ex.Message + }; + } + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting GPU usage"); + return new GpuUsage { Error = ex.Message }; + } + } + + public async Task> GetDiskUsageAsync() + { + try + { + return await Task.Run(() => + { + var diskUsages = new List(); + + var drives = DriveInfo.GetDrives(); + foreach (var drive in drives) + { + if (drive.IsReady) + { + var diskUsage = new DiskUsage + { + DriveLetter = drive.Name, + Label = drive.VolumeLabel, + FileSystem = drive.DriveFormat, + TotalSize = (ulong)drive.TotalSize, + FreeSpace = (ulong)drive.AvailableFreeSpace, + UsedSpace = (ulong)(drive.TotalSize - drive.AvailableFreeSpace), + UsagePercentage = (float)(drive.TotalSize - drive.AvailableFreeSpace) / drive.TotalSize * 100 + }; + + // Get disk performance data + try + { + var diskName = drive.Name.Replace("\\", "").Replace(":", ""); +#pragma warning disable CA1416 // Validate platform compatibility + using var readCounter = new PerformanceCounter("LogicalDisk", "Disk Read Bytes/sec", diskName); + using var writeCounter = new PerformanceCounter("LogicalDisk", "Disk Write Bytes/sec", diskName); + using var timeCounter = new PerformanceCounter("LogicalDisk", "% Disk Time", diskName); + + readCounter.NextValue(); + writeCounter.NextValue(); + timeCounter.NextValue(); + + Thread.Sleep(1000); + + diskUsage.ReadSpeed = readCounter.NextValue() / (1024 * 1024); // Convert to MB/s + diskUsage.WriteSpeed = writeCounter.NextValue() / (1024 * 1024); // Convert to MB/s + diskUsage.DiskTime = timeCounter.NextValue(); +#pragma warning restore CA1416 // Validate platform compatibility + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get disk performance data for drive {Drive}", drive.Name); + } + + // Try to determine if it's an SSD + try + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher($"SELECT * FROM Win32_LogicalDisk WHERE DeviceID='{drive.Name.TrimEnd('\\')}'"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + // This is a simplified check; more sophisticated detection would be needed + var mediaType = obj["MediaType"]?.ToString(); + diskUsage.IsSSD = mediaType?.Contains("SSD") == true || mediaType?.Contains("Solid") == true; + break; + } +#pragma warning restore CA1416 // Validate platform compatibility + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not determine disk type for drive {Drive}", drive.Name); + } + + diskUsages.Add(diskUsage); + } + } + + return diskUsages; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting disk usage"); + return new List(); + } + } + + public async Task GetNetworkUsageAsync() + { + try + { + return await Task.Run(() => + { + var networkUsage = new NetworkUsage(); + var adapters = new List(); + + try + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface WHERE Name != 'Loopback'"); + using var collection = searcher.Get(); + + foreach (ManagementObject obj in collection) + { + var name = obj["Name"]?.ToString() ?? ""; + if (name.Contains("Loopback") || name.Contains("Isatap") || name.Contains("Teredo")) + continue; + + var bytesSent = Convert.ToInt64(obj["BytesSentPerSec"] ?? 0); + var bytesReceived = Convert.ToInt64(obj["BytesReceivedPerSec"] ?? 0); + var timestamp = DateTime.Now; + + var adapter = new NetworkAdapter + { + Name = name, + IsOperational = true + }; + + // Calculate speeds if we have previous data + var key = $"{name}_sent"; + if (_previousNetworkBytes.ContainsKey(key) && _previousNetworkTime.ContainsKey(key)) + { + var timeDiff = (timestamp - _previousNetworkTime[key]).TotalSeconds; + if (timeDiff > 0) + { + var bytesDiff = bytesSent - _previousNetworkBytes[key]; + adapter.UploadSpeed = (float)(bytesDiff / timeDiff / (1024 * 1024)); // MB/s + networkUsage.UploadSpeed += adapter.UploadSpeed; + } + } + + key = $"{name}_received"; + if (_previousNetworkBytes.ContainsKey(key) && _previousNetworkTime.ContainsKey(key)) + { + var timeDiff = (timestamp - _previousNetworkTime[key]).TotalSeconds; + if (timeDiff > 0) + { + var bytesDiff = bytesReceived - _previousNetworkBytes[key]; + adapter.DownloadSpeed = (float)(bytesDiff / timeDiff / (1024 * 1024)); // MB/s + networkUsage.DownloadSpeed += adapter.DownloadSpeed; + } + } + + // Store current values for next calculation + _previousNetworkBytes[$"{name}_sent"] = bytesSent; + _previousNetworkBytes[$"{name}_received"] = bytesReceived; + _previousNetworkTime[$"{name}_sent"] = timestamp; + _previousNetworkTime[$"{name}_received"] = timestamp; + + networkUsage.BytesSent += (ulong)bytesSent; + networkUsage.BytesReceived += (ulong)bytesReceived; + + adapters.Add(adapter); + } +#pragma warning restore CA1416 // Validate platform compatibility + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get network performance data"); + } + + networkUsage.Adapters = adapters; + return networkUsage; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting network usage"); + return new NetworkUsage(); + } + } + + public async Task> GetTopProcessesAsync(int count = 10) + { + try + { + return await Task.Run(() => + { + var processes = Process.GetProcesses() + .Where(p => !p.HasExited) + .Select(p => + { + try + { + return new ProcessInfo + { + Id = p.Id, + Name = p.ProcessName, + MemoryUsage = (ulong)p.WorkingSet64, + ProcessorTime = p.TotalProcessorTime, + StartTime = p.StartTime, + ExecutablePath = p.MainModule?.FileName ?? "", + CommandLine = GetProcessCommandLine(p.Id) + }; + } + catch + { + return null; // Skip processes that throw exceptions + } + }) + .Where(p => p != null) + .OrderByDescending(p => p!.MemoryUsage) + .Take(count) + .Cast() + .ToList(); + + return processes; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting top processes"); + return new List(); + } + } + + private async Task GetCpuTemperatureAsync() + { + try + { + return await Task.Run(() => + { + // Try to get CPU temperature from WMI +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + var temp = Convert.ToDouble(obj["CurrentTemperature"]); + return (float)((temp - 2732) / 10.0); // Convert from tenths of Kelvin to Celsius + } +#pragma warning restore CA1416 // Validate platform compatibility + return 0f; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get CPU temperature"); + return 0f; + } + } + + private async Task GetTemperatureInfoAsync() + { + try + { + return await Task.Run(() => + { + var temperatureInfo = new TemperatureInfo + { + CPU = GetCpuTemperatureAsync().Result, + HardDrives = new List() + }; + + // Try to get hard drive temperatures + try + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + var instanceName = obj["InstanceName"]?.ToString() ?? ""; + // This would need more sophisticated parsing for actual SMART data + temperatureInfo.HardDrives.Add(new HardDriveTemp + { + Drive = instanceName, + Temperature = 0f, // Would need SMART data parsing + Health = "Unknown" + }); + } +#pragma warning restore CA1416 // Validate platform compatibility + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get hard drive temperatures"); + } + + return temperatureInfo; + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting temperature information"); + return new TemperatureInfo(); + } + } + + private string GetProcessCommandLine(int processId) + { + try + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher($"SELECT CommandLine FROM Win32_Process WHERE ProcessId = {processId}"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + return obj["CommandLine"]?.ToString() ?? ""; + } +#pragma warning restore CA1416 // Validate platform compatibility + return ""; + } + catch + { + return ""; + } + } + + public void Dispose() + { +#pragma warning disable CA1416 // Validate platform compatibility + foreach (var counter in _counters.Values) + { + counter?.Dispose(); + } + _counters.Clear(); +#pragma warning restore CA1416 // Validate platform compatibility + } + } +} diff --git a/Services/SystemInfoService.cs b/Services/SystemInfoService.cs new file mode 100644 index 0000000..d6af567 --- /dev/null +++ b/Services/SystemInfoService.cs @@ -0,0 +1,217 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using System.Diagnostics; +using System.Management; + +namespace ResourceMonitorService.Services +{ + public interface ISystemInfoService + { + Task GetSystemInfoAsync(); + Task IsVirtualMachineAsync(); + Task GetHypervisorVendorAsync(); + Task GetBootTimeAsync(); + Task GetCpuNameAsync(); + } + + public class SystemInfoService : ISystemInfoService + { + private readonly ILogger _logger; + private readonly MonitoringSettings _settings; + private SystemInfo? _cachedSystemInfo; + private DateTime _lastCacheUpdate = DateTime.MinValue; + private readonly TimeSpan _cacheExpiration = TimeSpan.FromMinutes(5); + + public SystemInfoService(ILogger logger, IOptions settings) + { + _logger = logger; + _settings = settings.Value; + } + + public async Task GetSystemInfoAsync() + { + if (_cachedSystemInfo != null && DateTime.Now - _lastCacheUpdate < _cacheExpiration) + { + _cachedSystemInfo.Uptime = DateTime.Now - _cachedSystemInfo.BootTime; + return _cachedSystemInfo; + } + + try + { + var systemInfo = new SystemInfo + { + MachineName = Environment.MachineName, + OSVersion = System.Runtime.InteropServices.RuntimeInformation.OSDescription, + OSArchitecture = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture.ToString(), + ProcessorCount = Environment.ProcessorCount, + TotalPhysicalMemory = await GetTotalPhysicalMemoryAsync(), + CPUName = await GetCpuNameAsync(), + BootTime = await GetBootTimeAsync(), + Domain = Environment.UserDomainName, + IsVirtualMachine = await IsVirtualMachineAsync(), + HypervisorVendor = await GetHypervisorVendorAsync() + }; + + systemInfo.Uptime = DateTime.Now - systemInfo.BootTime; + + _cachedSystemInfo = systemInfo; + _lastCacheUpdate = DateTime.Now; + + return systemInfo; + } + catch (Exception ex) + { + _logger.LogError(ex, "Error getting system information"); + throw; + } + } + + public async Task IsVirtualMachineAsync() + { + try + { + return await Task.Run(() => + { + // Check for common VM indicators + var queries = new[] + { + "SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE '%VMware%' OR Manufacturer LIKE '%VirtualBox%' OR Manufacturer LIKE '%Microsoft Corporation%' OR Model LIKE '%Virtual%'", + "SELECT * FROM Win32_BIOS WHERE SerialNumber LIKE '%VMware%' OR SerialNumber LIKE '%VirtualBox%' OR Version LIKE '%VBOX%'", + "SELECT * FROM Win32_SystemEnclosure WHERE Manufacturer LIKE '%VMware%' OR Manufacturer LIKE '%VirtualBox%'" + }; + + foreach (var query in queries) + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher(query); + using var collection = searcher.Get(); + if (collection.Count > 0) + return true; +#pragma warning restore CA1416 // Validate platform compatibility + } + + return false; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not determine if running in virtual machine"); + return false; + } + } + + public async Task GetHypervisorVendorAsync() + { + try + { + return await Task.Run(() => + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + var manufacturer = obj["Manufacturer"]?.ToString() ?? ""; + var model = obj["Model"]?.ToString() ?? ""; + + if (manufacturer.Contains("VMware")) + return "VMware"; + if (manufacturer.Contains("Microsoft Corporation") && model.Contains("Virtual")) + return "Hyper-V"; + if (manufacturer.Contains("QEMU")) + return "QEMU/KVM"; + if (manufacturer.Contains("VirtualBox")) + return "VirtualBox"; + if (manufacturer.Contains("Xen")) + return "Xen"; + } +#pragma warning restore CA1416 // Validate platform compatibility + return "Unknown"; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not determine hypervisor vendor"); + return "Unknown"; + } + } + + public async Task GetBootTimeAsync() + { + try + { + return await Task.Run(() => + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher("SELECT LastBootUpTime FROM Win32_OperatingSystem"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + var bootTime = obj["LastBootUpTime"]?.ToString(); + if (!string.IsNullOrEmpty(bootTime)) + { + return ManagementDateTimeConverter.ToDateTime(bootTime); + } + } +#pragma warning restore CA1416 // Validate platform compatibility + return DateTime.Now.AddMilliseconds(-Environment.TickCount64); + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get boot time from WMI, using tick count"); + return DateTime.Now.AddMilliseconds(-Environment.TickCount64); + } + } + + public async Task GetCpuNameAsync() + { + try + { + return await Task.Run(() => + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_Processor"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + return obj["Name"]?.ToString()?.Trim() ?? "Unknown CPU"; + } +#pragma warning restore CA1416 // Validate platform compatibility + return "Unknown CPU"; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get CPU name"); + return "Unknown CPU"; + } + } + + private async Task GetTotalPhysicalMemoryAsync() + { + try + { + return await Task.Run(() => + { +#pragma warning disable CA1416 // Validate platform compatibility + using var searcher = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem"); + using var collection = searcher.Get(); + foreach (ManagementObject obj in collection) + { + return (ulong)obj["TotalPhysicalMemory"]; + } +#pragma warning restore CA1416 // Validate platform compatibility + return (ulong)0; + }); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Could not get total physical memory"); + return 0; + } + } + } +} diff --git a/Worker.cs b/Worker.cs index 502b5a7..3a73bbb 100644 --- a/Worker.cs +++ b/Worker.cs @@ -1,166 +1,246 @@ -using System.Diagnostics; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Newtonsoft.Json; -using Microsoft.AspNetCore.Http; -using System.Runtime.InteropServices; -using System.Management; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using ResourceMonitorService.Services; +using System.Diagnostics; namespace ResourceMonitorService { public class Worker : BackgroundService { + private readonly ILogger _logger; private readonly IHostApplicationLifetime _lifetime; + private readonly ISystemInfoService _systemInfoService; + private readonly IResourceMonitorService _resourceMonitorService; + private readonly IGameDetectionService _gameDetectionService; + private readonly IAlertService _alertService; + private readonly ApiSettings _apiSettings; + private readonly MonitoringSettings _monitoringSettings; - public Worker(IHostApplicationLifetime lifetime) + public Worker( + ILogger logger, + IHostApplicationLifetime lifetime, + ISystemInfoService systemInfoService, + IResourceMonitorService resourceMonitorService, + IGameDetectionService gameDetectionService, + IAlertService alertService, + IOptions apiSettings, + IOptions monitoringSettings) { + _logger = logger; _lifetime = lifetime; + _systemInfoService = systemInfoService; + _resourceMonitorService = resourceMonitorService; + _gameDetectionService = gameDetectionService; + _alertService = alertService; + _apiSettings = apiSettings.Value; + _monitoringSettings = monitoringSettings.Value; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { - var builder = WebApplication.CreateBuilder(); - builder.Services.AddCors(options => - { - options.AddPolicy("AllowAllOrigins", - builder => builder - .WithOrigins("http://localhost:4200","http://192.168.50.52:4200","http://vmwin11:4200") - .AllowAnyHeader() - .AllowAnyMethod()); - }); - builder.Services.AddControllers().AddNewtonsoftJson(); + _logger.LogInformation("Resource Monitor Service starting..."); - // Read the API key from appsettings.json - var configuration = builder.Configuration; - var apiKey = configuration["ApiSettings:ApiKey"]; + var builder = WebApplication.CreateBuilder(); + + // Configure CORS + builder.Services.AddCors(options => + { + options.AddPolicy("AllowedOrigins", policy => + policy.WithOrigins(_apiSettings.AllowedOrigins.ToArray()) + .AllowAnyHeader() + .AllowAnyMethod()); + }); + + builder.Services.AddControllers().AddNewtonsoftJson(); var app = builder.Build(); - // Middleware to validate API key - // This middleware checks for the presence of the API key in the request headers - // and compares it with the expected API key from appsettings.json. - // If the API key is missing or invalid, it returns a 401 Unauthorized response. - // - /* app.Use(async (context, next) => - { - if (!context.Request.Headers.TryGetValue("X-API-KEY", out var extractedApiKey) || extractedApiKey != apiKey) - { - context.Response.StatusCode = StatusCodes.Status401Unauthorized; - await context.Response.WriteAsync("Unauthorized: Invalid API Key"); - return; - } - - await next(); - }); */ - // Apply CORS policy to allow all origins - app.UseCors("AllowAllOrigins"); - - app.MapGet("/api/resource-usage", async context => + // API Key middleware (if enabled) + if (_apiSettings.RequireApiKey) { - var currentTime = GetCurrentTime(); - - var computerInfo = GetComputerInfo(); - var cpuUsage = GetCpuUsage(); - var ramUsage = GetRamUsage(); - var gpuUsage = GetGpuUsage(); - var runningGame = GetCurrentlyRunningGame(); - - var resourceUsage = new + app.Use(async (context, next) => { - CurrentTime = currentTime, - ComputerInfo = computerInfo, - CPU = cpuUsage, - RAM = ramUsage, - GPU = gpuUsage, - CurrentlyRunningGame = runningGame - }; + if (!context.Request.Headers.TryGetValue("X-API-KEY", out var extractedApiKey) || + extractedApiKey != _apiSettings.ApiKey) + { + context.Response.StatusCode = StatusCodes.Status401Unauthorized; + await context.Response.WriteAsync("Unauthorized: Invalid API Key"); + return; + } + await next(); + }); + } - var json = JsonConvert.SerializeObject(resourceUsage); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(json); + app.UseCors("AllowedOrigins"); + + // Enhanced API endpoints + ConfigureApiEndpoints(app); + + // Start background monitoring + _ = Task.Run(async () => await BackgroundMonitoringLoop(stoppingToken), stoppingToken); + + // Start the web application + _ = app.RunAsync(stoppingToken); + + await Task.Delay(Timeout.Infinite, stoppingToken); + } + + private void ConfigureApiEndpoints(WebApplication app) + { + var basePath = _apiSettings.BasePath; + + // System information endpoints + app.MapGet($"{basePath}/system-info", async () => + Results.Ok(await _systemInfoService.GetSystemInfoAsync())); + + // Resource usage endpoints + app.MapGet($"{basePath}/resource-usage", async () => + Results.Ok(await _resourceMonitorService.GetResourceUsageAsync())); + + app.MapGet($"{basePath}/cpu-usage", async () => + Results.Ok(await _resourceMonitorService.GetCpuUsageAsync())); + + app.MapGet($"{basePath}/memory-usage", async () => + Results.Ok(await _resourceMonitorService.GetMemoryUsageAsync())); + + app.MapGet($"{basePath}/gpu-usage", async () => + Results.Ok(await _resourceMonitorService.GetGpuUsageAsync())); + + app.MapGet($"{basePath}/disk-usage", async () => + Results.Ok(await _resourceMonitorService.GetDiskUsageAsync())); + + app.MapGet($"{basePath}/network-usage", async () => + Results.Ok(await _resourceMonitorService.GetNetworkUsageAsync())); + + app.MapGet($"{basePath}/top-processes", async (int count = 10) => + Results.Ok(await _resourceMonitorService.GetTopProcessesAsync(count))); + + // Game detection endpoints + app.MapGet($"{basePath}/current-game", async () => + Results.Ok(await _gameDetectionService.GetCurrentlyRunningGameAsync())); + + app.MapGet($"{basePath}/all-games", async () => + Results.Ok(await _gameDetectionService.GetAllDetectedGamesAsync())); + + app.MapGet($"{basePath}/fullscreen-status", async () => + Results.Ok(new { IsFullscreen = await _gameDetectionService.IsGameRunningFullscreenAsync() })); + + // Alert endpoints + app.MapGet($"{basePath}/alerts/active", async () => + Results.Ok(await _alertService.GetActiveAlertsAsync())); + + app.MapGet($"{basePath}/alerts/history", async (int count = 100) => + Results.Ok(await _alertService.GetAlertHistoryAsync(count))); + + app.MapPost($"{basePath}/alerts/{{alertId}}/resolve", async (string alertId) => + { + await _alertService.ResolveAlertAsync(alertId); + return Results.Ok(new { Message = "Alert resolved successfully" }); }); - app.MapPost("/api/kill-process", async context => - { - try - { - var idStr = await new StreamReader(context.Request.Body).ReadToEndAsync(); - int processId = Convert.ToInt32(idStr); + app.MapGet($"{basePath}/alerts/enabled", async () => + Results.Ok(new { Enabled = await _alertService.IsAlertingEnabledAsync() })); - Process[] processes = Process.GetProcesses().Where(p => p.Id == processId).ToArray(); - - if (processes.Length > 0) - { - foreach (var process in processes) - { - try - { - process.Kill(); - await context.Response.WriteAsync($"Process with ID {processId} has been killed."); - } - catch (Exception ex) - { - await context.Response.WriteAsync($"Error killing process with ID {processId}: {ex.Message}"); - } - } - } - else - { - await context.Response.WriteAsync($"No process found with ID {processId}."); - } - } - catch (Exception ex) - { - await context.Response.WriteAsync($"An error occurred: {ex.Message}"); - } - }); - - /* curl -X POST http://localhost:5000/api/force-shutdown -d "5000" */ - /* Invoke-WebRequest -Uri "http://localhost:5000/api/force-shutdown" -Method POST -Body "50000" -ContentType "text/plain" */ - app.MapPost("/api/force-shutdown", async context => + // Process management endpoints (enhanced) + app.MapPost($"{basePath}/process/kill", async (HttpContext context) => { try { - var requestBody = await new StreamReader(context.Request.Body).ReadToEndAsync(); - var parameters = JsonConvert.DeserializeObject(requestBody); + var body = await new StreamReader(context.Request.Body).ReadToEndAsync(); + var request = JsonConvert.DeserializeObject(body); + + int processId = request?.ProcessId ?? 0; + bool force = request?.Force ?? false; - string action = parameters?.Action?.ToString()?.ToLower(); // "shutdown" or "restart" - int delaySeconds = parameters?.DelaySeconds ?? 0; - - // Validate action input - if (action != "shutdown" && action != "restart" && action != "cancel") + if (processId <= 0) { - await context.Response.WriteAsync("Invalid action. Use 'shutdown', 'restart', or 'cancel'."); - return; + return Results.BadRequest("Invalid process ID"); + } + + var processes = Process.GetProcesses().Where(p => p.Id == processId).ToArray(); + + if (processes.Length == 0) + { + return Results.NotFound($"No process found with ID {processId}"); + } + + var process = processes[0]; + var processName = process.ProcessName; + + if (force) + { + process.Kill(true); // Force kill entire process tree + } + else + { + process.CloseMainWindow(); // Try graceful close first + + // Wait a bit for graceful close + await Task.Delay(3000); + + if (!process.HasExited) + { + process.Kill(); + } + } + + _logger.LogWarning("Process {ProcessName} (ID: {ProcessId}) was terminated", processName, processId); + return Results.Ok(new { Message = $"Process {processName} (ID: {processId}) has been terminated." }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error terminating process"); + return Results.Problem(ex.Message); + } + }); + + // Enhanced shutdown/restart endpoints + app.MapPost($"{basePath}/system/shutdown", async (HttpContext context) => + { + try + { + var body = await new StreamReader(context.Request.Body).ReadToEndAsync(); + var request = JsonConvert.DeserializeObject(body); + + string action = request?.Action?.ToString()?.ToLower() ?? "shutdown"; + int delaySeconds = request?.DelaySeconds ?? 0; + string message = request?.Message?.ToString() ?? "System shutdown initiated by Resource Monitor"; + + if (action != "shutdown" && action != "restart" && action != "cancel") + { + return Results.BadRequest("Invalid action. Use 'shutdown', 'restart', or 'cancel'."); } - //if action is stop, then cancel the shutdown if (action == "cancel") { - var processStartInfoCancel = new ProcessStartInfo + var cancelProcess = new ProcessStartInfo { FileName = "shutdown", Arguments = "/a", CreateNoWindow = true, UseShellExecute = false }; - - Process.Start(processStartInfoCancel); - await context.Response.WriteAsync("Shutdown cancelled."); - return; + Process.Start(cancelProcess); + + _logger.LogWarning("System shutdown cancelled"); + return Results.Ok(new { Message = "Shutdown cancelled." }); } - // Validate delay input if (delaySeconds < 0) { - await context.Response.WriteAsync("Delay must be a non-negative integer."); - return; + return Results.BadRequest("Delay must be a non-negative integer."); } - // Determine the shutdown command - string shutdownCommand = action == "shutdown" ? $"/s /f /t {delaySeconds}" : $"/r /f /t {delaySeconds}"; + string shutdownCommand = action == "shutdown" + ? $"/s /f /t {delaySeconds} /c \"{message}\"" + : $"/r /f /t {delaySeconds} /c \"{message}\""; var processStartInfo = new ProcessStartInfo { @@ -172,274 +252,233 @@ namespace ResourceMonitorService Process.Start(processStartInfo); - await context.Response.WriteAsync($"{action.ToUpper()} command executed with a delay of {delaySeconds} seconds."); + _logger.LogWarning("System {Action} initiated with {Delay} seconds delay", action, delaySeconds); + return Results.Ok(new { + Message = $"{action.ToUpper()} command executed with a delay of {delaySeconds} seconds.", + Action = action, + DelaySeconds = delaySeconds, + Timestamp = DateTime.Now + }); } catch (Exception ex) { - await context.Response.WriteAsync($"An error occurred: {ex.Message}"); + _logger.LogError(ex, "Error executing system command"); + return Results.Problem(ex.Message); } }); - app.MapGet("/api/stop", async context => + // VM-specific endpoints for Unraid + app.MapGet($"{basePath}/vm/info", async () => { - await context.Response.WriteAsync("Stopping the service..."); - _lifetime.StopApplication(); + var systemInfo = await _systemInfoService.GetSystemInfoAsync(); + return Results.Ok(new + { + IsVirtualMachine = systemInfo.IsVirtualMachine, + HypervisorVendor = systemInfo.HypervisorVendor, + Uptime = systemInfo.Uptime, + BootTime = systemInfo.BootTime, + MachineName = systemInfo.MachineName, + Domain = systemInfo.Domain + }); }); - app.MapGet("/", () => "Resource Monitor Service is running."); - app.MapGet("/api/current-time", () => Results.Ok(GetCurrentTime())); - app.MapGet("/api/computer-info", () => Results.Ok(GetComputerInfo())); - app.MapGet("/api/cpu-usage", () => Results.Ok(GetCpuUsage())); - app.MapGet("/api/ram-usage", () => Results.Ok(GetRamUsage())); - app.MapGet("/api/gpu-usage", () => Results.Ok(GetGpuUsage())); - app.MapGet("/api/running-game", () => Results.Ok(GetCurrentlyRunningGame())); - app.MapGet("/api/total-physical-memory", () => Results.Ok(GetTotalPhysicalMemory())); - app.MapGet("/api/total-available-memory", () => Results.Ok(new { TotalAvailableMemory = Environment.WorkingSet })); + // Performance history endpoint (simple in-memory storage) + app.MapGet($"{basePath}/performance/history", async (int minutes = 60) => + { + // This would ideally be stored in a database or time-series database + // For now, return current snapshot with timestamp + var usage = await _resourceMonitorService.GetResourceUsageAsync(); + return Results.Ok(new { + Current = usage, + Message = "Historical data not implemented yet - showing current values" + }); + }); - app.MapGet("/health", () => Results.Ok("Service is healthy.")); + // Health check endpoint + app.MapGet($"{basePath}/health", async () => + { + var systemInfo = await _systemInfoService.GetSystemInfoAsync(); + var alerts = await _alertService.GetActiveAlertsAsync(); + + return Results.Ok(new + { + Status = "Healthy", + Timestamp = DateTime.Now, + Uptime = systemInfo.Uptime, + ActiveAlerts = alerts.Count, + MonitoringEnabled = new + { + GPU = _monitoringSettings.EnableGpuMonitoring, + Disk = _monitoringSettings.EnableDiskMonitoring, + Network = _monitoringSettings.EnableNetworkMonitoring, + Temperature = _monitoringSettings.EnableTemperatureMonitoring, + Processes = _monitoringSettings.EnableProcessMonitoring, + Games = _monitoringSettings.EnableGameDetection, + Alerts = _monitoringSettings.EnableAlerts + } + }); + }); + // Service control endpoints + app.MapPost($"{basePath}/service/stop", () => + { + _logger.LogWarning("Service stop requested via API"); + _lifetime.StopApplication(); + return Results.Ok(new { Message = "Stopping the service..." }); + }); - _ = app.RunAsync(stoppingToken); + // Configuration endpoint + app.MapGet($"{basePath}/config", () => Results.Ok(new + { + MonitoringSettings = new + { + UpdateInterval = _monitoringSettings.UpdateIntervalMs, + EnableGpuMonitoring = _monitoringSettings.EnableGpuMonitoring, + EnableDiskMonitoring = _monitoringSettings.EnableDiskMonitoring, + EnableNetworkMonitoring = _monitoringSettings.EnableNetworkMonitoring, + EnableTemperatureMonitoring = _monitoringSettings.EnableTemperatureMonitoring, + EnableProcessMonitoring = _monitoringSettings.EnableProcessMonitoring, + EnableGameDetection = _monitoringSettings.EnableGameDetection, + EnableAlerts = _monitoringSettings.EnableAlerts + }, + ApiSettings = new + { + BasePath = _apiSettings.BasePath, + RequireApiKey = _apiSettings.RequireApiKey, + AllowedOrigins = _apiSettings.AllowedOrigins + } + })); - await Task.Delay(Timeout.Infinite, stoppingToken); + // Service metrics endpoint + app.MapGet($"{basePath}/metrics", async () => + { + var usage = await _resourceMonitorService.GetResourceUsageAsync(); + var systemInfo = await _systemInfoService.GetSystemInfoAsync(); + return Results.Ok(new + { + Service = "Resource Monitor Service", + Version = "2.0.0", + Status = "Running", + Timestamp = DateTime.Now, + Uptime = systemInfo.Uptime, + LastUpdate = usage.Timestamp, + Performance = new + { + CPU = usage.CPU.Usage, + Memory = usage.Memory.UsagePercentage, + GPU = usage.GPU.Usage, + ActiveProcesses = usage.TopProcesses.Count + } + }); + }); + + // Root endpoint + app.MapGet("/", () => Results.Ok(new + { + Service = "Resource Monitor Service for Unraid VM", + Version = "2.0.0", + Status = "Running", + Timestamp = DateTime.Now, + ApiBasePath = _apiSettings.BasePath, + Endpoints = new[] + { + $"{_apiSettings.BasePath}/health", + $"{_apiSettings.BasePath}/system-info", + $"{_apiSettings.BasePath}/resource-usage", + $"{_apiSettings.BasePath}/cpu-usage", + $"{_apiSettings.BasePath}/memory-usage", + $"{_apiSettings.BasePath}/gpu-usage", + $"{_apiSettings.BasePath}/disk-usage", + $"{_apiSettings.BasePath}/network-usage", + $"{_apiSettings.BasePath}/top-processes", + $"{_apiSettings.BasePath}/current-game", + $"{_apiSettings.BasePath}/alerts/active", + $"{_apiSettings.BasePath}/vm/info", + $"{_apiSettings.BasePath}/config", + $"{_apiSettings.BasePath}/metrics" + } + })); + + _logger.LogInformation("API endpoints configured. Base path: {BasePath}", _apiSettings.BasePath); } - private object GetComputerInfo() + private async Task BackgroundMonitoringLoop(CancellationToken cancellationToken) { - return new - { - MachineName = Environment.MachineName, - OSVersion = RuntimeInformation.OSDescription, - OSArchitecture = RuntimeInformation.OSArchitecture.ToString(), - ProcessorCount = Environment.ProcessorCount - }; - } + _logger.LogInformation("Background monitoring started"); + int errorCount = 0; + int successfulCycles = 0; - private object GetCpuUsage() - { -#pragma warning disable CA1416 // Validate platform compatibility - var cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); -#pragma warning restore CA1416 // Validate platform compatibility -#pragma warning disable CA1416 // Validate platform compatibility - cpuCounter.NextValue(); -#pragma warning restore CA1416 // Validate platform compatibility - Thread.Sleep(1000); // Wait a second to get a valid reading - -#pragma warning disable CA1416 // Validate platform compatibility - var usage = cpuCounter.NextValue(); -#pragma warning restore CA1416 // Validate platform compatibility - if (usage > 80) + while (!cancellationToken.IsCancellationRequested) { - // Get the current processes and sort them by CPU usage in descending order - var processes = Process.GetProcesses() - .Select(p => + try + { + // Get current resource usage + var resourceUsage = await _resourceMonitorService.GetResourceUsageAsync(); + + // Add current game info if game detection is enabled + if (_monitoringSettings.EnableGameDetection) { try { - return new - { - Process = p, - TotalProcessorTime = p.TotalProcessorTime - }; + resourceUsage.RunningGame = await _gameDetectionService.GetCurrentlyRunningGameAsync(); } - catch + catch (Exception ex) { - return null; // Skip processes that throw exceptions - } - }) - .Where(p => p != null) - .OrderByDescending(p => p.TotalProcessorTime) - .Select(p => p.Process) - .ToList(); - - // Create a new anonymous type containing the CPU usage, RAM usage, and the top 3 highest CPU-using processes - return new - { - Usage = usage, - Process1 = new - { - Name = processes.ElementAt(0).ProcessName, - TotalProcessorTime = processes.ElementAt(0).TotalProcessorTime, - WorkingSet64 = processes.ElementAt(0).WorkingSet64 / (1024 * 1024) // Convert to MB - }, - Process2 = new - { - Name = processes.ElementAt(1).ProcessName, - TotalProcessorTime = processes.ElementAt(1).TotalProcessorTime, - WorkingSet64 = processes.ElementAt(1).WorkingSet64 / (1024 * 1024) // Convert to MB - }, - Process3 = new - { - Name = processes.ElementAt(2).ProcessName, - TotalProcessorTime = processes.ElementAt(2).TotalProcessorTime, - WorkingSet64 = processes.ElementAt(2).WorkingSet64 / (1024 * 1024) // Convert to MB - } - }; - } - - return new - { - Usage = usage - }; - } - - private float GetRamUsage() - { -#pragma warning disable CA1416 // Validate platform compatibility - var ramCounter = new PerformanceCounter("Memory", "Available MBytes"); -#pragma warning restore CA1416 // Validate platform compatibility - var totalMemory = GetTotalPhysicalMemory(); -#pragma warning disable CA1416 // Validate platform compatibility - var availableMemory = ramCounter.NextValue() * 1024 * 1024; -#pragma warning restore CA1416 // Validate platform compatibility - return (float)(totalMemory - availableMemory) / totalMemory * 100; - } - - private ulong GetTotalPhysicalMemory() - { - ulong totalMemory = 0; -#pragma warning disable CA1416 // Validate platform compatibility - var searcher = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem"); -#pragma warning restore CA1416 // Validate platform compatibility -#pragma warning disable CA1416 // Validate platform compatibility - foreach (var obj in searcher.Get()) - { -#pragma warning disable CA1416 // Validate platform compatibility - totalMemory = (ulong)obj["TotalPhysicalMemory"]; -#pragma warning restore CA1416 // Validate platform compatibility - } -#pragma warning restore CA1416 // Validate platform compatibility - return totalMemory; - } - - private object GetGpuUsage() - { - /* if (!IsNvidiaGpuPresent()) - { - return new - { - Usage = 0, - Temperature = 0, - FanSpeed = 0, - IsAvailable = false, - Message = "No NVIDIA GPU detected" - }; - } */ - - try - { - - NvmlWrapper.NvmlInit(); - IntPtr device; - NvmlWrapper.NvmlDeviceGetHandleByIndex(0, out device); - NvmlWrapper.NvmlUtilization utilization; - NvmlWrapper.NvmlDeviceGetUtilizationRates(device, out utilization); - - uint temperature; - NvmlWrapper.NvmlDeviceGetTemperature(device, 0, out temperature); - - uint fanSpeed; - NvmlWrapper.NvmlDeviceGetFanSpeed(device, out fanSpeed); - - NvmlWrapper.NvmlShutdown(); - - return new - { - Usage = utilization.Gpu, - Temperature = temperature, - FanSpeed = fanSpeed, - IsAvailable = false, - Error = "" - }; - } - catch (Exception ex) - { - return new - { - Usage = 0, - Temperature = 0, - FanSpeed = 0, - IsAvailable = false, - Error = ex.Message - }; - } - } - - /* private bool IsNvidiaGpuPresent() - { - try - { - // Method 1: Try to initialize NVML - NvmlWrapper.NvmlInit(); - uint deviceCount = 0; - NvmlWrapper.NvmlDeviceGetCount(ref deviceCount); - NvmlWrapper.NvmlShutdown(); - - return deviceCount > 0; - } - catch - { - // Method 2: Fallback to checking using WMI - try - { - using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController WHERE Name LIKE '%NVIDIA%'")) - { - var collection = searcher.Get(); - return collection.Count > 0; - } - } - catch - { - return false; - } - } - } */ - - private object GetCurrentlyRunningGame() - { - var processes = Process.GetProcesses(); - - foreach (var process in processes) - { - try - { -#pragma warning disable CS8602 // Dereference of a possibly null reference. - var filePath = process.MainModule.FileName; -#pragma warning restore CS8602 // Dereference of a possibly null reference. - if (filePath.Contains(@"\steamapps\common\")) - { - // Extract the game directory name - var parts = filePath.Split(new[] { @"\steamapps\common\" }, StringSplitOptions.None); - if (parts.Length > 1) - { - var gamePath = parts[1]; - var gameName = gamePath.Split(Path.DirectorySeparatorChar)[0]; - return new + // Only log game detection errors occasionally to avoid spam + if (errorCount % 12 == 0) // Every minute if 5-second intervals { - GameName = gameName, - ExecutableName = Path.GetFileName(filePath), - FullPath = filePath, - ProcessId = process.Id, - MemoryUsage = process.WorkingSet64 / (1024 * 1024) + " MB", // Memory usage in MB - CpuTime = process.TotalProcessorTime.ToString(), - StartTime = process.StartTime.ToString("G"), // General date/time pattern - UserName = Environment.UserName // The user running the process - }; + _logger.LogDebug("Game detection error (suppressed): {Message}", ex.Message); + } } } + + // Check for alerts + if (_monitoringSettings.EnableAlerts) + { + await _alertService.CheckAndGenerateAlertsAsync(resourceUsage); + } + + successfulCycles++; + + // Log performance metrics occasionally + if (successfulCycles % 6 == 0) // Every 30 seconds with 5-second intervals + { + _logger.LogDebug("Performance: CPU: {CpuUsage:F1}%, Memory: {MemoryUsage:F1}%, GPU: {GpuUsage}%", + resourceUsage.CPU.Usage, + resourceUsage.Memory.UsagePercentage, + resourceUsage.GPU.Usage); + } + + // Log successful monitoring occasionally for health verification + if (successfulCycles % 120 == 0) // Every 10 minutes + { + _logger.LogInformation("Background monitoring healthy - completed {SuccessfulCycles} cycles", successfulCycles); + } + + errorCount = 0; // Reset error count on success } - catch (Exception) + catch (Exception ex) { - // Handle access exceptions or continue if not important + errorCount++; + + // Only log errors occasionally to avoid spam, but always log the first few + if (errorCount <= 3 || errorCount % 12 == 0) + { + _logger.LogError(ex, "Error in background monitoring loop (occurrence #{ErrorCount})", errorCount); + } + + // If too many consecutive errors, increase delay + if (errorCount > 10) + { + await Task.Delay(_monitoringSettings.UpdateIntervalMs * 2, cancellationToken); + continue; + } } + + await Task.Delay(_monitoringSettings.UpdateIntervalMs, cancellationToken); } - return "No Steam game is currently running."; - } - private string GetCurrentTime() - { - return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - } - + _logger.LogInformation("Background monitoring stopped after {SuccessfulCycles} successful cycles", successfulCycles); + } } } diff --git a/WorkerNew.cs b/WorkerNew.cs new file mode 100644 index 0000000..6a93c03 --- /dev/null +++ b/WorkerNew.cs @@ -0,0 +1,387 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using ResourceMonitorService.Services; +using System.Diagnostics; + +namespace ResourceMonitorService +{ + public class Worker : BackgroundService + { + private readonly ILogger _logger; + private readonly IHostApplicationLifetime _lifetime; + private readonly ISystemInfoService _systemInfoService; + private readonly IResourceMonitorService _resourceMonitorService; + private readonly IGameDetectionService _gameDetectionService; + private readonly IAlertService _alertService; + private readonly ApiSettings _apiSettings; + private readonly MonitoringSettings _monitoringSettings; + + public Worker( + ILogger logger, + IHostApplicationLifetime lifetime, + ISystemInfoService systemInfoService, + IResourceMonitorService resourceMonitorService, + IGameDetectionService gameDetectionService, + IAlertService alertService, + IOptions apiSettings, + IOptions monitoringSettings) + { + _logger = logger; + _lifetime = lifetime; + _systemInfoService = systemInfoService; + _resourceMonitorService = resourceMonitorService; + _gameDetectionService = gameDetectionService; + _alertService = alertService; + _apiSettings = apiSettings.Value; + _monitoringSettings = monitoringSettings.Value; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + _logger.LogInformation("Resource Monitor Service starting..."); + + var builder = WebApplication.CreateBuilder(); + + // Configure CORS + builder.Services.AddCors(options => + { + options.AddPolicy("AllowedOrigins", policy => + policy.WithOrigins(_apiSettings.AllowedOrigins.ToArray()) + .AllowAnyHeader() + .AllowAnyMethod()); + }); + + builder.Services.AddControllers().AddNewtonsoftJson(); + + var app = builder.Build(); + + // API Key middleware (if enabled) + if (_apiSettings.RequireApiKey) + { + app.Use(async (context, next) => + { + if (!context.Request.Headers.TryGetValue("X-API-KEY", out var extractedApiKey) || + extractedApiKey != _apiSettings.ApiKey) + { + context.Response.StatusCode = StatusCodes.Status401Unauthorized; + await context.Response.WriteAsync("Unauthorized: Invalid API Key"); + return; + } + await next(); + }); + } + + app.UseCors("AllowedOrigins"); + + // Enhanced API endpoints + ConfigureApiEndpoints(app); + + // Start background monitoring + _ = Task.Run(async () => await BackgroundMonitoringLoop(stoppingToken), stoppingToken); + + // Start the web application + _ = app.RunAsync(stoppingToken); + + await Task.Delay(Timeout.Infinite, stoppingToken); + } + + private void ConfigureApiEndpoints(WebApplication app) + { + var basePath = _apiSettings.BasePath; + + // System information endpoints + app.MapGet($"{basePath}/system-info", async () => + Results.Ok(await _systemInfoService.GetSystemInfoAsync())); + + // Resource usage endpoints + app.MapGet($"{basePath}/resource-usage", async () => + Results.Ok(await _resourceMonitorService.GetResourceUsageAsync())); + + app.MapGet($"{basePath}/cpu-usage", async () => + Results.Ok(await _resourceMonitorService.GetCpuUsageAsync())); + + app.MapGet($"{basePath}/memory-usage", async () => + Results.Ok(await _resourceMonitorService.GetMemoryUsageAsync())); + + app.MapGet($"{basePath}/gpu-usage", async () => + Results.Ok(await _resourceMonitorService.GetGpuUsageAsync())); + + app.MapGet($"{basePath}/disk-usage", async () => + Results.Ok(await _resourceMonitorService.GetDiskUsageAsync())); + + app.MapGet($"{basePath}/network-usage", async () => + Results.Ok(await _resourceMonitorService.GetNetworkUsageAsync())); + + app.MapGet($"{basePath}/top-processes", async (int count = 10) => + Results.Ok(await _resourceMonitorService.GetTopProcessesAsync(count))); + + // Game detection endpoints + app.MapGet($"{basePath}/current-game", async () => + Results.Ok(await _gameDetectionService.GetCurrentlyRunningGameAsync())); + + app.MapGet($"{basePath}/all-games", async () => + Results.Ok(await _gameDetectionService.GetAllDetectedGamesAsync())); + + app.MapGet($"{basePath}/fullscreen-status", async () => + Results.Ok(new { IsFullscreen = await _gameDetectionService.IsGameRunningFullscreenAsync() })); + + // Alert endpoints + app.MapGet($"{basePath}/alerts/active", async () => + Results.Ok(await _alertService.GetActiveAlertsAsync())); + + app.MapGet($"{basePath}/alerts/history", async (int count = 100) => + Results.Ok(await _alertService.GetAlertHistoryAsync(count))); + + app.MapPost($"{basePath}/alerts/{{alertId}}/resolve", async (string alertId) => + { + await _alertService.ResolveAlertAsync(alertId); + return Results.Ok(new { Message = "Alert resolved successfully" }); + }); + + app.MapGet($"{basePath}/alerts/enabled", async () => + Results.Ok(new { Enabled = await _alertService.IsAlertingEnabledAsync() })); + + // Process management endpoints (enhanced) + app.MapPost($"{basePath}/process/kill", async (HttpContext context) => + { + try + { + var body = await new StreamReader(context.Request.Body).ReadToEndAsync(); + var request = JsonConvert.DeserializeObject(body); + + int processId = request?.ProcessId ?? 0; + bool force = request?.Force ?? false; + + if (processId <= 0) + { + return Results.BadRequest("Invalid process ID"); + } + + var processes = Process.GetProcesses().Where(p => p.Id == processId).ToArray(); + + if (processes.Length == 0) + { + return Results.NotFound($"No process found with ID {processId}"); + } + + var process = processes[0]; + var processName = process.ProcessName; + + if (force) + { + process.Kill(true); // Force kill entire process tree + } + else + { + process.CloseMainWindow(); // Try graceful close first + + // Wait a bit for graceful close + await Task.Delay(3000); + + if (!process.HasExited) + { + process.Kill(); + } + } + + _logger.LogWarning("Process {ProcessName} (ID: {ProcessId}) was terminated", processName, processId); + return Results.Ok(new { Message = $"Process {processName} (ID: {processId}) has been terminated." }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error terminating process"); + return Results.Problem(ex.Message); + } + }); + + // Enhanced shutdown/restart endpoints + app.MapPost($"{basePath}/system/shutdown", async (HttpContext context) => + { + try + { + var body = await new StreamReader(context.Request.Body).ReadToEndAsync(); + var request = JsonConvert.DeserializeObject(body); + + string action = request?.Action?.ToString()?.ToLower() ?? "shutdown"; + int delaySeconds = request?.DelaySeconds ?? 0; + string message = request?.Message?.ToString() ?? "System shutdown initiated by Resource Monitor"; + + if (action != "shutdown" && action != "restart" && action != "cancel") + { + return Results.BadRequest("Invalid action. Use 'shutdown', 'restart', or 'cancel'."); + } + + if (action == "cancel") + { + var cancelProcess = new ProcessStartInfo + { + FileName = "shutdown", + Arguments = "/a", + CreateNoWindow = true, + UseShellExecute = false + }; + Process.Start(cancelProcess); + + _logger.LogWarning("System shutdown cancelled"); + return Results.Ok(new { Message = "Shutdown cancelled." }); + } + + if (delaySeconds < 0) + { + return Results.BadRequest("Delay must be a non-negative integer."); + } + + string shutdownCommand = action == "shutdown" + ? $"/s /f /t {delaySeconds} /c \"{message}\"" + : $"/r /f /t {delaySeconds} /c \"{message}\""; + + var processStartInfo = new ProcessStartInfo + { + FileName = "shutdown", + Arguments = shutdownCommand, + CreateNoWindow = true, + UseShellExecute = false + }; + + Process.Start(processStartInfo); + + _logger.LogWarning("System {Action} initiated with {Delay} seconds delay", action, delaySeconds); + return Results.Ok(new { + Message = $"{action.ToUpper()} command executed with a delay of {delaySeconds} seconds.", + Action = action, + DelaySeconds = delaySeconds, + Timestamp = DateTime.Now + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error executing system command"); + return Results.Problem(ex.Message); + } + }); + + // VM-specific endpoints for Unraid + app.MapGet($"{basePath}/vm/info", async () => + { + var systemInfo = await _systemInfoService.GetSystemInfoAsync(); + return Results.Ok(new + { + IsVirtualMachine = systemInfo.IsVirtualMachine, + HypervisorVendor = systemInfo.HypervisorVendor, + Uptime = systemInfo.Uptime, + BootTime = systemInfo.BootTime, + MachineName = systemInfo.MachineName, + Domain = systemInfo.Domain + }); + }); + + // Performance history endpoint (simple in-memory storage) + app.MapGet($"{basePath}/performance/history", async (int minutes = 60) => + { + // This would ideally be stored in a database or time-series database + // For now, return current snapshot with timestamp + var usage = await _resourceMonitorService.GetResourceUsageAsync(); + return Results.Ok(new { + Current = usage, + Message = "Historical data not implemented yet - showing current values" + }); + }); + + // Health check endpoint + app.MapGet($"{basePath}/health", async () => + { + var systemInfo = await _systemInfoService.GetSystemInfoAsync(); + var alerts = await _alertService.GetActiveAlertsAsync(); + + return Results.Ok(new + { + Status = "Healthy", + Timestamp = DateTime.Now, + Uptime = systemInfo.Uptime, + ActiveAlerts = alerts.Count, + MonitoringEnabled = new + { + GPU = _monitoringSettings.EnableGpuMonitoring, + Disk = _monitoringSettings.EnableDiskMonitoring, + Network = _monitoringSettings.EnableNetworkMonitoring, + Temperature = _monitoringSettings.EnableTemperatureMonitoring, + Processes = _monitoringSettings.EnableProcessMonitoring, + Games = _monitoringSettings.EnableGameDetection, + Alerts = _monitoringSettings.EnableAlerts + } + }); + }); + + // Service control endpoints + app.MapPost($"{basePath}/service/stop", () => + { + _logger.LogWarning("Service stop requested via API"); + _lifetime.StopApplication(); + return Results.Ok(new { Message = "Stopping the service..." }); + }); + + // Root endpoint + app.MapGet("/", () => Results.Ok(new + { + Service = "Resource Monitor Service", + Version = "2.0.0", + Status = "Running", + Timestamp = DateTime.Now, + ApiBasePath = _apiSettings.BasePath, + Documentation = $"{_apiSettings.BasePath}/health" + })); + + _logger.LogInformation("API endpoints configured. Base path: {BasePath}", _apiSettings.BasePath); + } + + private async Task BackgroundMonitoringLoop(CancellationToken cancellationToken) + { + _logger.LogInformation("Background monitoring started"); + + while (!cancellationToken.IsCancellationRequested) + { + try + { + // Get current resource usage + var resourceUsage = await _resourceMonitorService.GetResourceUsageAsync(); + + // Add current game info if game detection is enabled + if (_monitoringSettings.EnableGameDetection) + { + resourceUsage.RunningGame = await _gameDetectionService.GetCurrentlyRunningGameAsync(); + } + + // Check for alerts + if (_monitoringSettings.EnableAlerts) + { + await _alertService.CheckAndGenerateAlertsAsync(resourceUsage); + } + + // Log performance metrics occasionally + if (DateTime.Now.Second % 30 == 0) // Every 30 seconds + { + _logger.LogDebug("Performance: CPU: {CpuUsage:F1}%, Memory: {MemoryUsage:F1}%, GPU: {GpuUsage}%", + resourceUsage.CPU.Usage, + resourceUsage.Memory.UsagePercentage, + resourceUsage.GPU.Usage); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Error in background monitoring loop"); + } + + await Task.Delay(_monitoringSettings.UpdateIntervalMs, cancellationToken); + } + + _logger.LogInformation("Background monitoring stopped"); + } + } +} diff --git a/appsettings.json b/appsettings.json index 78a1652..a6c7da4 100644 --- a/appsettings.json +++ b/appsettings.json @@ -14,6 +14,81 @@ } }, "ApiSettings": { - "ApiKey": "b7f3e8a1-4c2d-4d9f-9a6e-2a1c5d7f8e9a" + "ApiKey": "b7f3e8a1-4c2d-4d9f-9a6e-2a1c5d7f8e9a", + "RequireApiKey": false, + "AllowedOrigins": [ + "http://localhost:4200", + "http://192.168.50.52:4200", + "http://vmwin11:4200", + "http://unraid:4200" + ], + "EnableSwagger": false, + "BasePath": "/api" + }, + "MonitoringSettings": { + "UpdateIntervalMs": 5000, + "DataRetentionDays": 7, + "EnableGpuMonitoring": true, + "EnableDiskMonitoring": true, + "EnableNetworkMonitoring": true, + "EnableTemperatureMonitoring": true, + "EnableProcessMonitoring": true, + "EnableGameDetection": true, + "EnableAlerts": true, + "MaxProcessesToTrack": 10, + "MaxHistoryPoints": 1000, + "GamePlatformPaths": [ + "\\steamapps\\common\\", + "\\Epic Games\\", + "\\GOG Galaxy\\Games\\", + "\\Origin Games\\", + "\\Ubisoft Game Launcher\\games\\" + ], + "AlertThresholds": [ + { + "Component": "CPU", + "WarningThreshold": 80, + "CriticalThreshold": 95, + "DurationSeconds": 30, + "IsEnabled": true + }, + { + "Component": "Memory", + "WarningThreshold": 85, + "CriticalThreshold": 95, + "DurationSeconds": 30, + "IsEnabled": true + }, + { + "Component": "GPU", + "WarningThreshold": 85, + "CriticalThreshold": 95, + "DurationSeconds": 30, + "IsEnabled": true + }, + { + "Component": "CPUTemp", + "WarningThreshold": 75, + "CriticalThreshold": 85, + "DurationSeconds": 60, + "IsEnabled": true + }, + { + "Component": "GPUTemp", + "WarningThreshold": 80, + "CriticalThreshold": 90, + "DurationSeconds": 60, + "IsEnabled": true + } + ] + }, + "LoggingSettings": { + "LogLevel": "Information", + "LogPath": "logs", + "MaxLogFiles": 30, + "MaxLogFileSizeMB": 10, + "EnableFileLogging": true, + "EnableConsoleLogging": true, + "EnablePerformanceLogging": false } } diff --git a/install-service.ps1 b/install-service.ps1 new file mode 100644 index 0000000..5dcb53d --- /dev/null +++ b/install-service.ps1 @@ -0,0 +1,193 @@ +# Resource Monitor Service - Installation Script for Windows Service +# Run this in PowerShell as Administrator + +param( + [switch]$Uninstall +) + +$SERVICE_NAME = "ResourceMonitorService" +$SERVICE_DISPLAY_NAME = "Resource Monitor Service v2.0" +$SERVICE_DESCRIPTION = "Monitors VM resources for Unraid integration" +$INSTALL_PATH = "C:\Services\ResourceMonitor" + +Write-Host "=== Resource Monitor Service - Windows Service Installer ===" -ForegroundColor Cyan +Write-Host + +# Check if running as administrator +if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { + Write-Host "ERROR: This script must be run as Administrator" -ForegroundColor Red + Write-Host "Please run PowerShell as Administrator and try again" -ForegroundColor Yellow + exit 1 +} + +if ($Uninstall) { + Write-Host "Uninstalling Resource Monitor Service..." -ForegroundColor Yellow + + # Stop the service + Write-Host "Stopping service..." + try { + Stop-Service -Name $SERVICE_NAME -Force -ErrorAction SilentlyContinue + Write-Host "Service stopped successfully" -ForegroundColor Green + } catch { + Write-Host "Service was not running" -ForegroundColor Yellow + } + + # Remove the service + Write-Host "Removing service..." + try { + sc.exe delete $SERVICE_NAME + Write-Host "Service removed successfully" -ForegroundColor Green + } catch { + Write-Host "Failed to remove service: $($_.Exception.Message)" -ForegroundColor Red + } + + # Remove firewall rule + Write-Host "Removing firewall rule..." + try { + Remove-NetFirewallRule -DisplayName "Resource Monitor Service" -ErrorAction SilentlyContinue + Write-Host "Firewall rule removed" -ForegroundColor Green + } catch { + Write-Host "Firewall rule not found or already removed" -ForegroundColor Yellow + } + + # Optionally remove installation directory + $removeFiles = Read-Host "Remove installation files from $INSTALL_PATH? (y/N)" + if ($removeFiles -eq "y" -or $removeFiles -eq "Y") { + try { + Remove-Item -Path $INSTALL_PATH -Recurse -Force -ErrorAction Stop + Write-Host "Installation files removed" -ForegroundColor Green + } catch { + Write-Host "Failed to remove installation files: $($_.Exception.Message)" -ForegroundColor Red + } + } + + Write-Host "Uninstallation complete!" -ForegroundColor Green + exit 0 +} + +Write-Host "Installing Resource Monitor Service as Windows Service..." -ForegroundColor Green + +# Create installation directory +Write-Host "Creating installation directory..." +try { + New-Item -ItemType Directory -Path $INSTALL_PATH -Force | Out-Null + Write-Host "Installation directory created: $INSTALL_PATH" -ForegroundColor Green +} catch { + Write-Host "ERROR: Failed to create installation directory: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +} + +# Build the service in release mode +Write-Host "Building service..." +try { + $buildResult = dotnet publish --configuration Release --output $INSTALL_PATH + if ($LASTEXITCODE -ne 0) { + throw "Build failed with exit code $LASTEXITCODE" + } + Write-Host "Service built successfully" -ForegroundColor Green +} catch { + Write-Host "ERROR: Build failed: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +} + +# Stop existing service if running +Write-Host "Stopping existing service (if running)..." +try { + Stop-Service -Name $SERVICE_NAME -Force -ErrorAction SilentlyContinue + Write-Host "Existing service stopped" -ForegroundColor Green +} catch { + Write-Host "No existing service found" -ForegroundColor Yellow +} + +# Remove existing service if it exists +Write-Host "Removing existing service (if exists)..." +try { + sc.exe delete $SERVICE_NAME 2>$null +} catch { + # Ignore errors if service doesn't exist +} + +# Install the service +Write-Host "Installing Windows Service..." +try { + $serviceBinPath = "`"$INSTALL_PATH\ResourceMonitorService.exe`" --windows-service" + $createResult = sc.exe create $SERVICE_NAME binPath= $serviceBinPath DisplayName= $SERVICE_DISPLAY_NAME start= auto + + if ($LASTEXITCODE -ne 0) { + throw "Failed to create service with exit code $LASTEXITCODE" + } + + # Set service description + sc.exe description $SERVICE_NAME $SERVICE_DESCRIPTION + + Write-Host "Windows Service created successfully" -ForegroundColor Green +} catch { + Write-Host "ERROR: Failed to create Windows Service: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +} + +# Configure service recovery options +Write-Host "Configuring service recovery options..." +try { + sc.exe failure $SERVICE_NAME reset= 300 actions= restart/5000/restart/5000/restart/10000 + Write-Host "Service recovery options configured" -ForegroundColor Green +} catch { + Write-Host "WARNING: Failed to configure service recovery options" -ForegroundColor Yellow +} + +# Configure firewall rule +Write-Host "Configuring Windows Firewall..." +try { + New-NetFirewallRule -DisplayName "Resource Monitor Service" -Direction Inbound -Protocol TCP -LocalPort 5000 -Action Allow -Profile Any -ErrorAction Stop + Write-Host "Firewall rule created" -ForegroundColor Green +} catch { + Write-Host "WARNING: Failed to create firewall rule. You may need to configure manually." -ForegroundColor Yellow + Write-Host "Manual command: New-NetFirewallRule -DisplayName 'Resource Monitor Service' -Direction Inbound -Protocol TCP -LocalPort 5000 -Action Allow" -ForegroundColor Gray +} + +# Start the service +Write-Host "Starting service..." +try { + Start-Service -Name $SERVICE_NAME + Write-Host "Service started successfully" -ForegroundColor Green +} catch { + Write-Host "ERROR: Failed to start service: $($_.Exception.Message)" -ForegroundColor Red + Write-Host "Check Windows Event Log for details" -ForegroundColor Yellow + exit 1 +} + +# Wait a moment and check service status +Start-Sleep -Seconds 3 +$serviceStatus = Get-Service -Name $SERVICE_NAME +Write-Host "Service Status: $($serviceStatus.Status)" -ForegroundColor $(if ($serviceStatus.Status -eq "Running") { "Green" } else { "Red" }) + +Write-Host +Write-Host "=== Installation Complete ===" -ForegroundColor Cyan +Write-Host "Service Name: $SERVICE_NAME" -ForegroundColor White +Write-Host "Installation Path: $INSTALL_PATH" -ForegroundColor White +Write-Host "Service URL: http://localhost:5000" -ForegroundColor White +Write-Host "API Health Check: http://localhost:5000/api/health" -ForegroundColor White +Write-Host +Write-Host "The service is now running and will start automatically with Windows." -ForegroundColor Green +Write-Host "You can manage it through Services.msc or using PowerShell commands:" -ForegroundColor White +Write-Host " - Stop: Stop-Service -Name $SERVICE_NAME" -ForegroundColor Gray +Write-Host " - Start: Start-Service -Name $SERVICE_NAME" -ForegroundColor Gray +Write-Host " - Status: Get-Service -Name $SERVICE_NAME" -ForegroundColor Gray +Write-Host " - Restart: Restart-Service -Name $SERVICE_NAME" -ForegroundColor Gray +Write-Host +Write-Host "To uninstall: .\install-service.ps1 -Uninstall" -ForegroundColor Yellow + +# Test the API endpoint +Write-Host +Write-Host "Testing API endpoint..." -ForegroundColor Yellow +Start-Sleep -Seconds 5 +try { + $response = Invoke-RestMethod -Uri "http://localhost:5000/api/health" -TimeoutSec 10 + Write-Host "API Test Result: SUCCESS" -ForegroundColor Green + Write-Host "Service Version: $($response.Service)" -ForegroundColor White + Write-Host "Status: $($response.Status)" -ForegroundColor White +} catch { + Write-Host "API Test Result: FAILED" -ForegroundColor Red + Write-Host "The service may still be starting up. Wait a few minutes and try accessing:" -ForegroundColor Yellow + Write-Host "http://localhost:5000/api/health" -ForegroundColor White +} diff --git a/install-service.sh b/install-service.sh new file mode 100644 index 0000000..4863b5d --- /dev/null +++ b/install-service.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# Resource Monitor Service - Installation Script for Windows Service + +SERVICE_NAME="ResourceMonitorService" +SERVICE_DISPLAY_NAME="Resource Monitor Service v2.0" +SERVICE_DESCRIPTION="Monitors VM resources for Unraid integration" +INSTALL_PATH="C:\Services\ResourceMonitor" + +echo "=== Resource Monitor Service - Windows Service Installer ===" +echo + +# Check if running as administrator +if [[ ! $(id -u) -eq 0 ]]; then + echo "ERROR: This script must be run as Administrator" + echo "Please run PowerShell as Administrator and try again" + exit 1 +fi + +echo "Installing Resource Monitor Service as Windows Service..." + +# Create installation directory +echo "Creating installation directory..." +mkdir -p "$INSTALL_PATH" + +# Build the service in release mode +echo "Building service..." +dotnet publish --configuration Release --output "$INSTALL_PATH" + +if [[ $? -ne 0 ]]; then + echo "ERROR: Build failed" + exit 1 +fi + +# Stop existing service if running +echo "Stopping existing service (if running)..." +sc stop "$SERVICE_NAME" 2>/dev/null + +# Remove existing service if it exists +echo "Removing existing service (if exists)..." +sc delete "$SERVICE_NAME" 2>/dev/null + +# Install the service +echo "Installing Windows Service..." +sc create "$SERVICE_NAME" \ + binPath="\"$INSTALL_PATH\\ResourceMonitorService.exe\" --windows-service" \ + DisplayName="$SERVICE_DISPLAY_NAME" \ + Description="$SERVICE_DESCRIPTION" \ + start=auto + +if [[ $? -ne 0 ]]; then + echo "ERROR: Failed to create Windows Service" + exit 1 +fi + +# Configure service recovery options +echo "Configuring service recovery options..." +sc failure "$SERVICE_NAME" reset=300 actions=restart/5000/restart/5000/restart/10000 + +# Configure firewall rule +echo "Configuring Windows Firewall..." +powershell -Command "New-NetFirewallRule -DisplayName 'Resource Monitor Service' -Direction Inbound -Protocol TCP -LocalPort 5000 -Action Allow -Profile Any" 2>/dev/null + +# Start the service +echo "Starting service..." +sc start "$SERVICE_NAME" + +if [[ $? -eq 0 ]]; then + echo + echo "=== Installation Complete ===" + echo "Service Name: $SERVICE_NAME" + echo "Installation Path: $INSTALL_PATH" + echo "Service URL: http://localhost:5000" + echo "API Health Check: http://localhost:5000/api/health" + echo + echo "The service is now running and will start automatically with Windows." + echo "You can manage it through Services.msc or using sc commands:" + echo " - Stop: sc stop $SERVICE_NAME" + echo " - Start: sc start $SERVICE_NAME" + echo " - Status: sc query $SERVICE_NAME" + echo + echo "To uninstall: sc stop $SERVICE_NAME && sc delete $SERVICE_NAME" +else + echo "ERROR: Failed to start service" + echo "Check Windows Event Log for details" + exit 1 +fi diff --git a/logs/resourcemonitor-20250807.txt b/logs/resourcemonitor-20250807.txt new file mode 100644 index 0000000..20fde8a --- /dev/null +++ b/logs/resourcemonitor-20250807.txt @@ -0,0 +1,7073 @@ +2025-08-07 02:24:22.933 +08:00 [INF] Starting Resource Monitor Service +2025-08-07 02:24:23.741 +08:00 [WRN] Failed to initialize performance counter: Bytes Sent/sec +System.InvalidOperationException: Instance '*' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.InitializeCounters() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 66 +2025-08-07 02:24:23.754 +08:00 [WRN] Failed to initialize performance counter: Bytes Received/sec +System.InvalidOperationException: Instance '*' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.InitializeCounters() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 66 +2025-08-07 02:24:23.763 +08:00 [INF] Resource Monitor Service starting... +2025-08-07 02:24:23.806 +08:00 [INF] API endpoints configured. Base path: /api +2025-08-07 02:24:23.808 +08:00 [INF] Background monitoring started +2025-08-07 02:24:23.817 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:23.824 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:24:23.857 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:23.862 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:23.869 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2025-08-07 02:24:23.870 +08:00 [INF] Hosting environment: Development +2025-08-07 02:24:23.871 +08:00 [INF] Content root path: C:\Work\DEV\ResourceUsageAPI +2025-08-07 02:24:23.874 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:24:24.179 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:27.838 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:31.584 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:24:31.586 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:31.591 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:31.596 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:31.623 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:24:31.630 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:31.638 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:24:31.773 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:24:36.792 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:36.797 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:24:36.798 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:36.801 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:36.804 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:36.829 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:24:40.430 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:44.172 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:24:44.174 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:44.179 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:44.183 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:44.203 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:24:44.208 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:44.215 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:24:44.334 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:24:49.347 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:49.351 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:24:49.352 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:49.356 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:49.358 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:49.386 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:24:52.997 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:56.760 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:24:56.763 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:56.768 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:56.772 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:24:56.790 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:24:56.794 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:24:56.801 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:24:56.905 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:25:01.913 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:01.918 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:01.920 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:01.921 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:01.930 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:01.952 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:02.533 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:05.556 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:09.296 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:09.298 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:09.302 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:09.306 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:09.325 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:09.331 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:09.337 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:25:09.461 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:25:14.472 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:14.477 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:14.478 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:14.481 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:14.483 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:14.510 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:18.110 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:21.849 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:21.851 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:21.855 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:21.860 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:21.878 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:21.884 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:21.891 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:25:22.006 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:25:27.020 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:27.025 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:27.029 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:27.030 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:27.030 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:27.056 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:30.663 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:34.405 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:34.407 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:34.414 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:34.419 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:34.443 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:34.449 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:34.456 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:25:34.602 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:25:39.617 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:39.622 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:39.622 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:39.628 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:39.628 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:39.655 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:43.258 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:47.010 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:25:47.012 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:47.017 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:47.021 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:25:47.038 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:25:47.044 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:25:47.051 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:25:47.165 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:25:51.224 +08:00 [WRN] Service stop requested via API +2025-08-07 02:25:51.224 +08:00 [INF] Application is shutting down... +2025-08-07 02:29:29.988 +08:00 [INF] Starting Resource Monitor Service +2025-08-07 02:29:30.349 +08:00 [WRN] Failed to initialize performance counter: Bytes Sent/sec +System.InvalidOperationException: Instance '*' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.InitializeCounters() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 66 +2025-08-07 02:29:30.357 +08:00 [WRN] Failed to initialize performance counter: Bytes Received/sec +System.InvalidOperationException: Instance '*' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.InitializeCounters() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 66 +2025-08-07 02:29:30.363 +08:00 [INF] Resource Monitor Service starting... +2025-08-07 02:29:30.395 +08:00 [INF] API endpoints configured. Base path: /api +2025-08-07 02:29:30.397 +08:00 [INF] Background monitoring started +2025-08-07 02:29:30.402 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:30.410 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:29:30.438 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:30.442 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:30.443 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:30.446 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2025-08-07 02:29:30.447 +08:00 [INF] Hosting environment: Development +2025-08-07 02:29:30.447 +08:00 [INF] Content root path: C:\Work\DEV\ResourceUsageAPI +2025-08-07 02:29:30.453 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:29:34.083 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:37.811 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:29:37.813 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:37.818 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:37.822 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:37.844 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:29:37.851 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:37.858 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:29:37.971 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:29:42.979 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:42.984 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:29:42.984 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:42.988 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:42.991 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:43.016 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:29:46.620 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:50.348 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:29:50.350 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:50.354 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:50.358 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:50.376 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:29:50.383 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:50.390 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:29:50.491 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:29:55.501 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:55.506 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:29:55.507 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:55.511 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:29:55.512 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:29:55.539 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:29:59.134 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:02.854 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:02.857 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:02.861 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:02.865 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:02.882 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:02.888 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:02.895 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:30:02.998 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:30:08.009 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:08.013 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:08.015 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:08.019 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:08.021 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:08.045 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:11.635 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:15.361 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:15.363 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:15.372 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:15.377 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:15.395 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:15.401 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:15.408 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:30:15.513 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:30:20.524 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:20.528 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:20.529 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:20.533 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:20.535 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:20.560 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:24.167 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:27.877 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:27.879 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:27.884 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:27.888 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:27.907 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:27.912 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:27.919 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:30:28.023 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:30:33.038 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:33.043 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:33.044 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:33.048 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:33.049 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:33.074 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:36.659 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:40.379 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:40.388 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:40.393 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:40.397 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:40.415 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:40.420 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:40.428 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:30:40.531 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:30:45.534 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:45.538 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:45.539 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:45.543 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:45.545 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:45.571 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:49.155 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:52.890 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:30:52.892 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:52.896 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:52.900 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:52.917 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:52.923 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:52.930 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:30:53.035 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:30:58.042 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:58.047 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:30:58.048 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:58.051 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:30:58.054 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:30:58.080 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:01.689 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:05.423 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:05.425 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:05.429 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:05.434 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:05.451 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:05.457 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:05.464 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:31:05.572 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:31:10.584 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:10.588 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:10.589 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:10.593 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:10.597 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:10.619 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:14.224 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:17.951 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:17.953 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:17.957 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:17.961 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:17.978 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:17.984 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:17.991 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:31:18.091 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:31:23.096 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:23.101 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:23.102 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:23.105 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:23.108 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:23.132 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:26.735 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:30.456 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:30.458 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:30.463 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:30.467 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:30.484 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:30.489 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:30.497 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:31:30.598 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:31:35.600 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:35.604 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:35.605 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:35.610 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:35.612 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:35.637 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:39.244 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:42.976 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:42.978 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:42.983 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:42.987 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:43.005 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:43.010 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:43.018 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:31:43.124 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:31:48.135 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:48.139 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:48.141 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:48.144 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:48.146 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:48.171 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:51.541 +08:00 [INF] Application is shutting down... +2025-08-07 02:31:55.261 +08:00 [INF] Starting Resource Monitor Service +2025-08-07 02:31:55.662 +08:00 [WRN] Failed to initialize performance counter: Bytes Sent/sec +System.InvalidOperationException: Instance '*' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.InitializeCounters() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 66 +2025-08-07 02:31:55.675 +08:00 [WRN] Failed to initialize performance counter: Bytes Received/sec +System.InvalidOperationException: Instance '*' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.InitializeCounters() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 66 +2025-08-07 02:31:55.681 +08:00 [INF] Resource Monitor Service starting... +2025-08-07 02:31:55.713 +08:00 [INF] API endpoints configured. Base path: /api +2025-08-07 02:31:55.715 +08:00 [INF] Background monitoring started +2025-08-07 02:31:55.720 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:55.727 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:31:55.748 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:55.753 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:31:55.754 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:31:55.763 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2025-08-07 02:31:55.764 +08:00 [INF] Hosting environment: Development +2025-08-07 02:31:55.764 +08:00 [INF] Content root path: C:\Work\DEV\ResourceUsageAPI +2025-08-07 02:31:55.772 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:31:59.375 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:03.107 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:03.113 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:03.118 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:03.123 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:03.146 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:03.153 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:03.161 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:32:03.296 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:32:08.305 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:08.310 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:08.310 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:08.315 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:08.316 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:08.340 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:11.939 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:15.669 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:15.671 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:15.676 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:15.680 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:15.698 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:15.704 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:15.712 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:32:15.827 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:32:20.835 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:20.839 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:20.841 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:20.845 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:20.846 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:20.873 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:24.470 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:28.200 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:28.202 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:28.207 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:28.211 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:28.228 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:28.234 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:28.241 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:32:28.354 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:32:33.372 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:33.376 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:33.377 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:33.381 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:33.384 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:33.409 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:37.005 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:40.738 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:40.740 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:40.744 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:40.748 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:40.765 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:40.771 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:40.778 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:32:40.885 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:32:45.897 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:45.902 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:45.903 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:45.907 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:45.909 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:45.935 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:48.512 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:48.516 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:48.517 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:48.521 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:48.523 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:48.557 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:49.533 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:52.149 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:53.266 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:53.267 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:53.272 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:53.276 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:53.293 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:53.299 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:53.306 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:32:53.419 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:32:55.869 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:32:55.871 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:55.876 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:55.880 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:55.897 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:55.903 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:55.909 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:32:58.435 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:58.440 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:32:58.440 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:58.444 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:32:58.446 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:32:58.472 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:02.064 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:05.789 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:05.791 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:05.796 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:05.800 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:05.816 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:05.822 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:05.828 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:33:05.928 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:33:10.935 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:10.939 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:10.941 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:10.943 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:10.946 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:10.971 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:14.569 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:18.289 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:18.291 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:18.296 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:18.301 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:18.318 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:18.323 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:18.330 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:33:18.436 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:33:23.443 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:23.450 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:23.450 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:23.453 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:23.456 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:23.478 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:27.083 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:30.808 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:30.810 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:30.814 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:30.818 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:30.839 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:30.844 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:30.851 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:33:30.960 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:33:35.976 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:35.980 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:35.981 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:35.986 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:35.986 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:36.011 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:39.622 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:43.361 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:43.363 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:43.368 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:43.372 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:43.389 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:43.395 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:43.401 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:33:43.510 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:33:48.526 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:48.530 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:48.531 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:48.535 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:48.536 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:48.563 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:52.156 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:55.887 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:33:55.889 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:55.893 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:55.897 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:33:55.915 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:33:55.920 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:33:55.926 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:33:56.035 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:34:01.039 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:01.044 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:01.046 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:01.048 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:01.050 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:01.075 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:04.687 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:08.410 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:08.413 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:08.417 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:08.421 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:08.439 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:08.444 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:08.450 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:34:08.561 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:34:13.571 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:13.575 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:13.576 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:13.580 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:13.581 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:13.607 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:17.208 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:20.937 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:20.940 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:20.944 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:20.948 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:20.966 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:20.978 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:20.984 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:34:21.108 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:34:26.125 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:26.129 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:26.130 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:26.134 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:26.135 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:26.161 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:29.759 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:33.480 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:33.483 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:33.487 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:33.492 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:33.511 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:33.517 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:33.524 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:34:33.642 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:34:38.659 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:38.663 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:38.665 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:38.669 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:38.670 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:38.696 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:42.293 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:46.018 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:46.019 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:46.024 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:46.027 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:46.047 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:46.054 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:46.060 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:34:46.171 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:34:51.179 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:51.183 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:51.184 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:51.188 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:51.189 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:51.215 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:54.806 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:58.540 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:34:58.542 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:58.546 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:58.550 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:34:58.568 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:34:58.574 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:34:58.581 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:34:58.693 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:35:03.699 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:03.703 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:03.705 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:03.709 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:03.710 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:03.735 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:07.325 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:11.047 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:11.049 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:11.053 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:11.057 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:11.075 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:11.081 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:11.088 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:35:11.198 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:35:16.206 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:16.210 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:16.212 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:16.215 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:16.216 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:16.243 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:19.833 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:23.557 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:23.559 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:23.564 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:23.568 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:23.585 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:23.591 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:23.597 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:35:23.706 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:35:28.721 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:28.725 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:28.726 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:28.730 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:28.731 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:28.757 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:32.360 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:36.094 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:36.096 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:36.100 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:36.104 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:36.121 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:36.127 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:36.134 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:35:36.238 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:35:41.243 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:41.247 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.OrderedIterator`1.ToList(Int32 minIdx, Int32 maxIdx) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:41.249 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:41.253 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:41.254 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:41.300 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:44.894 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:48.621 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:48.623 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:48.627 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:48.632 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:48.649 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:48.654 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:48.661 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:35:48.766 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:35:53.774 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:53.779 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:35:53.780 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:53.784 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:35:53.786 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:35:53.810 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:35:57.403 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:01.137 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:01.139 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:01.143 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:01.147 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:01.164 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:01.169 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:01.175 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:36:01.280 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:36:06.284 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:06.289 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:06.289 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:06.294 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:06.295 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:06.321 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:09.919 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:13.648 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:13.650 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:13.655 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:13.659 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:13.676 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:13.682 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:13.689 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:36:13.793 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:36:18.804 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:18.810 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:18.810 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:18.813 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:18.817 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:18.841 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:22.443 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:26.177 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:26.179 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:26.184 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:26.189 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:26.208 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:26.214 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:26.224 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:36:26.343 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:36:31.355 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:31.359 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:31.360 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:31.364 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:31.366 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:31.390 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:34.996 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:38.729 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:38.731 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:38.736 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:38.740 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:38.759 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:38.765 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:38.772 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:36:38.895 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:36:43.902 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:43.906 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:43.907 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:43.912 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:43.913 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:43.939 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:47.532 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:51.250 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:36:51.252 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:51.257 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:51.262 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:51.283 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:51.289 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:51.296 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:36:51.401 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:36:56.416 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:56.420 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:36:56.422 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:56.425 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:36:56.427 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:36:56.452 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:00.055 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:03.658 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:03.664 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:03.664 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:03.668 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:03.670 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:03.702 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:03.789 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:03.791 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:03.796 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:03.800 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:03.818 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:03.824 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:03.830 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:37:03.942 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:37:07.312 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:08.958 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:08.964 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:08.965 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:08.967 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:08.971 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:08.994 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:11.051 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:11.053 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:11.057 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:11.061 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:11.078 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:11.084 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:11.091 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:37:12.604 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:16.324 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:16.326 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:16.330 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:16.334 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:16.351 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:16.357 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:16.363 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:37:16.467 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:37:21.477 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:21.481 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:21.483 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:21.486 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:21.488 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:21.513 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:25.120 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:28.854 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:28.856 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:28.861 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:28.866 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:28.882 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:28.888 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:28.895 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:37:28.997 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:37:34.000 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:34.005 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:34.006 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:34.009 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:34.011 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:34.037 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:37.630 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:41.363 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:41.365 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:41.369 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:41.373 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:41.390 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:41.396 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:41.403 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:37:41.504 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:37:46.521 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:46.526 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Diagnostics.Process.get_HasExited() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__13_1(Process p) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 528 + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:46.527 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:46.531 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:46.533 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at System.Diagnostics.PerformanceCounter.NextValue() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:46.560 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:50.161 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:53.889 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:37:53.892 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:53.896 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:53.900 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:53.917 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:53.923 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:53.930 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:37:54.034 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:37:59.044 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:59.048 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:37:59.050 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:59.053 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:37:59.056 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:37:59.081 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:02.688 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:06.415 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:06.416 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:06.421 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:06.425 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:06.442 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:06.448 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:06.455 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:38:06.561 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:38:11.572 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:11.576 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:11.578 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:11.580 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:11.582 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:11.607 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:15.213 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:18.959 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:18.961 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:18.965 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:18.969 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:18.985 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:18.991 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:18.998 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:38:19.100 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:38:24.105 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:24.108 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:24.110 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:24.114 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:24.115 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:24.141 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:27.737 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:31.477 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:31.479 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:31.483 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:31.487 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:31.504 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:31.510 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:31.516 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:38:31.633 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:38:36.636 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:36.641 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:36.642 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:36.646 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:36.647 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:36.673 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:40.261 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:43.992 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:43.994 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:43.998 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:44.002 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:44.018 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:44.024 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:44.031 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:38:44.135 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:38:49.149 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:49.152 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:49.154 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:49.157 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:49.158 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:49.184 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:52.769 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:56.498 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:38:56.500 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:56.504 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:56.507 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:38:56.525 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:38:56.530 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:38:56.537 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:38:56.656 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:39:01.672 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:01.676 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:01.677 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:01.681 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:01.683 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:01.708 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:05.305 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:09.046 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:09.049 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:09.054 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:09.059 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:09.078 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:09.085 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:09.093 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:39:09.211 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:39:14.219 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:14.223 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:14.224 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:14.229 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:14.229 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:14.255 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:17.852 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:19.728 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:19.733 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:19.734 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:19.738 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:19.741 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:19.762 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:21.573 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:21.577 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:21.581 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:21.586 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:21.603 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:21.608 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:21.615 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:39:21.722 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:39:23.356 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:26.726 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:26.731 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:26.731 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:26.735 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:26.737 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:26.764 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:27.069 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:27.070 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:27.075 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:27.079 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:27.096 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:27.102 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:27.108 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:39:30.358 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:34.087 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:34.089 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:34.093 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:34.097 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:34.115 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:34.120 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:34.127 +08:00 [WRN] Could not get hard drive temperatures +System.Management.ManagementException: Access denied + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.b__15_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 609 +2025-08-07 02:39:34.239 +08:00 [WRN] Could not determine if game is running fullscreen +System.BadImageFormatException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies cannot be loaded for execution. (0x80131058) +File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.BadImageFormatException: Cannot load a reference assembly for execution. + at ResourceMonitorService.Services.GameDetectionService.<>c.b__12_0() + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.GameDetectionService.IsGameRunningFullscreenAsync() in C:\Work\DEV\ResourceUsageAPI\Services\GameDetectionService.cs:line 144 +2025-08-07 02:39:39.255 +08:00 [WRN] Could not get disk performance data for drive C:\ +System.InvalidOperationException: Instance 'C' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:39.260 +08:00 [ERR] Error getting top processes +System.ComponentModel.Win32Exception (5): Access is denied. + at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) + at System.Diagnostics.Process.UpdateHasExited() + at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext() + at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray() + at ResourceMonitorService.Services.ResourceMonitorService.<>c__DisplayClass13_0.b__0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 527 + at System.Threading.Tasks.Task`1.InnerInvoke() + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetTopProcessesAsync(Int32 count) in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 525 +2025-08-07 02:39:39.261 +08:00 [WRN] Could not get disk performance data for drive E:\ +System.InvalidOperationException: Instance 'E' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:39.265 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 +2025-08-07 02:39:39.267 +08:00 [WRN] Could not get disk performance data for drive G:\ +System.InvalidOperationException: Instance 'G' does not exist in the specified Category. + at System.Diagnostics.PerformanceCounter.NextSample() + at ResourceMonitorService.Services.ResourceMonitorService.b__11_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 386 +2025-08-07 02:39:39.294 +08:00 [WRN] Could not get additional GPU information via WMI +System.InvalidCastException: Unable to cast object of type 'System.UInt32' to type 'System.UInt64'. + at ResourceMonitorService.Services.ResourceMonitorService.b__10_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 299 +2025-08-07 02:39:42.887 +08:00 [WRN] Could not get CPU temperature +System.Management.ManagementException: Not supported + at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) + at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() + at ResourceMonitorService.Services.ResourceMonitorService.<>c.b__14_0() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 575 + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) +--- End of stack trace from previous location --- + at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) +--- End of stack trace from previous location --- + at ResourceMonitorService.Services.ResourceMonitorService.GetCpuTemperatureAsync() in C:\Work\DEV\ResourceUsageAPI\Services\ResourceMonitorService.cs:line 569 diff --git a/start-service.bat b/start-service.bat new file mode 100644 index 0000000..cfebe96 --- /dev/null +++ b/start-service.bat @@ -0,0 +1,41 @@ +@echo off +REM Resource Monitor Service - Quick Start Script + +echo Starting Resource Monitor Service v2.0... +echo. +echo This service will monitor your VM's resources and provide a REST API +echo for remote monitoring from your Unraid server. +echo. +echo Service will be available at: http://localhost:5000 +echo API Documentation: http://localhost:5000/api/health +echo. +echo Press Ctrl+C to stop the service +echo. + +REM Change to the script's directory +cd /d "%~dp0" + +REM Check if .NET 9 is installed +dotnet --version > nul 2>&1 +if errorlevel 1 ( + echo ERROR: .NET 9.0 Runtime is required but not found. + echo Please install .NET 9.0 Runtime from: https://dotnet.microsoft.com/download + pause + exit /b 1 +) + +REM Build and run the service +echo Building service... +dotnet build --configuration Release +if errorlevel 1 ( + echo ERROR: Build failed. Please check the error messages above. + pause + exit /b 1 +) + +echo. +echo Starting service on http://localhost:5000 +echo. +dotnet run --configuration Release + +pause