[PR #161] [MERGED] fix: replace try/catch ObjectDisposedException with _disposed flag #154

Closed
opened 2026-02-26 17:37:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Corsinvest/cv4pve-admin/pull/161
Author: @franklupo
Created: 2/17/2026
Status: Merged
Merged: 2/17/2026
Merged by: @franklupo

Base: mainHead: fix/semaphore-dispose-pattern


📝 Commits (1)

  • be4bd96 fix: replace try/catch ObjectDisposedException with _disposed flag in SemaphoreSlim pattern

📊 Changes

13 files changed (+52 additions, -14 deletions)

View changed files

📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Cluster/Replication.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Cluster/ResourcesEx.razor.cs (+4 -2)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Nodes/Charts.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Nodes/Disks.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Vm/Snapshot/Manager.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetDonutBase.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetInfoBase.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetSparklineBase.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetThumbDetailsBase.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/ClusterUsage/Gauge.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/ClusterUsage/GaugeStacked.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/ClusterUsage/Grid.razor.cs (+4 -1)
📝 src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/Maps/Render.razor.cs (+4 -1)

📄 Description

Summary

  • Replace try { _refreshLock?.Release(); } catch (ObjectDisposedException) { } with a cleaner _disposed flag pattern across all 13 components
  • Set _disposed = true before Dispose() to prevent new entries
  • Guard Release() with if (!_disposed) to avoid using a disposed semaphore
  • Applied to: ResourcesEx, Replication, Charts, Disks, Snapshot/Manager, WidgetDonutBase, WidgetInfoBase, WidgetSparklineBase, WidgetThumbDetailsBase, ClusterUsage/Gauge, ClusterUsage/GaugeStacked, ClusterUsage/Grid, Maps/Render

Test plan

  • Verify components dispose cleanly without ObjectDisposedException in logs
  • Verify refresh still works during normal operation

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Corsinvest/cv4pve-admin/pull/161 **Author:** [@franklupo](https://github.com/franklupo) **Created:** 2/17/2026 **Status:** ✅ Merged **Merged:** 2/17/2026 **Merged by:** [@franklupo](https://github.com/franklupo) **Base:** `main` ← **Head:** `fix/semaphore-dispose-pattern` --- ### 📝 Commits (1) - [`be4bd96`](https://github.com/Corsinvest/cv4pve-admin/commit/be4bd96345f33c98f48badc1b4857e66de58cbdc) fix: replace try/catch ObjectDisposedException with _disposed flag in SemaphoreSlim pattern ### 📊 Changes **13 files changed** (+52 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Cluster/Replication.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Cluster/ResourcesEx.razor.cs` (+4 -2) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Nodes/Charts.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Nodes/Disks.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/ProxmoxVE/Vm/Snapshot/Manager.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetDonutBase.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetInfoBase.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetSparklineBase.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Core/Components/Widgets/WidgetThumbDetailsBase.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/ClusterUsage/Gauge.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/ClusterUsage/GaugeStacked.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/ClusterUsage/Grid.razor.cs` (+4 -1) 📝 `src/Corsinvest.ProxmoxVE.Admin.Module.Resources/Components/Widgets/Maps/Render.razor.cs` (+4 -1) </details> ### 📄 Description ## Summary - Replace `try { _refreshLock?.Release(); } catch (ObjectDisposedException) { }` with a cleaner `_disposed` flag pattern across all 13 components - Set `_disposed = true` before `Dispose()` to prevent new entries - Guard `Release()` with `if (!_disposed)` to avoid using a disposed semaphore - Applied to: `ResourcesEx`, `Replication`, `Charts`, `Disks`, `Snapshot/Manager`, `WidgetDonutBase`, `WidgetInfoBase`, `WidgetSparklineBase`, `WidgetThumbDetailsBase`, `ClusterUsage/Gauge`, `ClusterUsage/GaugeStacked`, `ClusterUsage/Grid`, `Maps/Render` ## Test plan - [ ] Verify components dispose cleanly without `ObjectDisposedException` in logs - [ ] Verify refresh still works during normal operation --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 17:37:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-admin#154
No description provided.