Description
DebugProbe currently allows MaxEntries to be configured with negative values.
When MaxEntries <= -1, DebugEntryStore.Add can enter an infinite loop while attempting to trim stored entries.
Current Behavior
MaxEntries can currently be set to invalid values such as:
builder.Services.AddDebugProbe(options =>
{
options.MaxEntries = -1;
});
This can cause DebugEntryStore.Add to loop indefinitely while processing new entries.
Expected Behavior
DebugProbe should validate MaxEntries and reject invalid values before the application starts processing requests.
Suggested Fix
Validate MaxEntries during options configuration or initialization.
Recommended validation:
If an invalid value is provided, throw a clear configuration exception explaining the required range.
Result
After this change:
- Invalid configuration is detected early.
DebugEntryStore cannot enter an infinite loop.
- Users receive a clear error message instead of unexpected runtime behavior.
- Configuration becomes more predictable and robust.
Description
DebugProbe currently allows
MaxEntriesto be configured with negative values.When
MaxEntries <= -1,DebugEntryStore.Addcan enter an infinite loop while attempting to trim stored entries.Current Behavior
MaxEntriescan currently be set to invalid values such as:This can cause
DebugEntryStore.Addto loop indefinitely while processing new entries.Expected Behavior
DebugProbe should validate
MaxEntriesand reject invalid values before the application starts processing requests.Suggested Fix
Validate
MaxEntriesduring options configuration or initialization.Recommended validation:
If an invalid value is provided, throw a clear configuration exception explaining the required range.
Result
After this change:
DebugEntryStorecannot enter an infinite loop.