Files
Electron.NET/src/ElectronNET.API/Runtime/Helpers/DebuggerHelper.cs
Pierre Arnaud 0ee2bbe31c Refactor debugger detection to use shared DebuggerHelper
Created a new DebuggerHelper class with Lazy<bool> initialization that is
shared by both LaunchOrderDetector and UnpackagedDetector. This eliminates
code duplication and provides a cleaner, more maintainable solution.

- Added DebuggerHelper.cs with lazy-initialized IsAttached property
- Refactored LaunchOrderDetector to use DebuggerHelper
- Refactored UnpackagedDetector to use DebuggerHelper
- Removed nullable bool pattern in favor of Lazy<bool>
2026-01-31 09:38:26 +01:00

19 lines
544 B
C#

namespace ElectronNET.Runtime.Helpers
{
using System;
using System.Diagnostics;
/// <summary>
/// Helper class for debugger detection with lazy initialization.
/// </summary>
internal static class DebuggerHelper
{
/// <summary>
/// Gets whether a debugger is attached. This value is cached for performance.
/// </summary>
public static bool IsAttached => _isAttached.Value;
private static readonly Lazy<bool> _isAttached = new Lazy<bool>(() => Debugger.IsAttached);
}
}