Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>new RangeRetriever(groupDE, "member", false) is not disposed at the end of the function</issue_title>
<issue_description>### Description

dotnet 6.0

File: /src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs:1795
Problem: new RangeRetriever(groupDE, "member", false) is not disposed at the end of the function

Reproduction Steps

  1. Role: detected
    detected
    [ADStoreCtx.cs:[1795:0]](

  2. Role: tracepoint
    2.1 Step 1: Condition g.fakePrincipal taking any branch
    [ADStoreCtx.cs:[1750:17]]
    2.2 Step 2: Condition p.ContextType != ContextType.Domain taking any branch
    [ADStoreCtx.cs:[1757:17]]
    2.3 Step 3: Condition g.UnderlyingObject != null taking any branch
    [ADStoreCtx.cs:[1763:26]]
    2.4 Step 4: Condition p.fakePrincipal taking any branch
    [ADStoreCtx.cs:[1768:18]]
    2.5 Step 5: Condition Sid == null taking false branch
    [ADStoreCtx.cs:[1817:17]]
    2.6 Step 6: Condition string.IsNullOrEmpty(this.UserSuppliedServerName) taking any branch
    [ADStoreCtx.cs:[1827:42]]
    2.7 Step 7: Condition stringSid == null taking false branch
    [ADStoreCtx.cs:[1838:21]]
    2.8 Step 8: Condition sr == null taking any branch
    [ADStoreCtx.cs:[1855:21]]
    no escape
    [ADStoreCtx.cs:[1861:45]]
    2.9 Step 9: Exiting the foreach
    [ADStoreCtx.cs:[1861:45]]
    2.10 Step 10: Condition cachedMembersEnum is null taking any branch
    [ADStoreCtx.cs:[1861:45]]
    2.11 Step 11: Condition ds != null taking any branch
    [ADStoreCtx.cs:[1876:21]]
    2.12 Step 12: Condition defaultNCDirEntry != null taking any branch
    [ADStoreCtx.cs:[1880:21]]

Expected behavior

memory leak

Actual behavior

same

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

Found by Linux Verification Center (linuxtesting.org) with SVACE.</issue_description>

Comments on the Issue (you are @copilot in this section)

@ Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 See info in [area-owners.md](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you want to be subscribed.
Issue Details

Description

dotnet 6.0

File: /src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs:1795
Problem: new RangeRetriever(groupDE, "member", false) is not disposed at the end of the function

Reproduction Steps

  1. Role: detected
    detected
    [ADStoreCtx.cs:[1795:0]](

  2. Role: tracepoint
    2.1 Step 1: Condition g.fakePrincipal taking any branch
    [ADStoreCtx.cs:[1750:17]]
    2.2 Step 2: Condition p.ContextType != ContextType.Domain taking any branch
    [ADStoreCtx.cs:[1757:17]]
    2.3 Step 3: Condition g.UnderlyingObject != null taking any branch
    [ADStoreCtx.cs:[1763:26]]
    2.4 Step 4: Condition p.fakePrincipal taking any branch
    [ADStoreCtx.cs:[1768:18]]
    2.5 Step 5: Condition Sid == null taking false branch
    [ADStoreCtx.cs:[1817:17]]
    2.6 Step 6: Condition string.IsNullOrEmpty(this.UserSuppliedServerName) taking any branch
    [ADStoreCtx.cs:[1827:42]]
    2.7 Step 7: Condition stringSid == null taking false branch
    [ADStoreCtx.cs:[1838:21]]
    2.8 Step 8: Condition sr == null taking any branch
    [ADStoreCtx.cs:[1855:21]]
    no escape
    [ADStoreCtx.cs:[1861:45]]
    2.9 Step 9: Exiting the foreach
    [ADStoreCtx.cs:[1861:45]]
    2.10 Step 10: Condition cachedMembersEnum is null taking any branch
    [ADStoreCtx.cs:[1861:45]]
    2.11 Step 11: Condition ds != null taking any branch
    [ADStoreCtx.cs:[1876:21]]
    2.12 Step 12: Condition defaultNCDirEntry != null taking any branch
    [ADStoreCtx.cs:[1880:21]]

Expected behavior

memory leak

Actual behavior

same

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Author: achufistov
Assignees: -
Labels:

area-System.DirectoryServices, untriaged

Milestone: -
@danmoseley The code owners would likely welcome a PR or PRs for these. The library is considered mature so there is a risk calculus. There is the question of testing but such changes are often hard to write a test for.

Fixes #94755


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI requested a review from stephentoub October 23, 2025 21:16
@akoeplinger akoeplinger deleted the copilot/fix-range-retriever-disposal branch November 21, 2025 12:08
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new RangeRetriever(groupDE, "member", false) is not disposed at the end of the function

2 participants