Skip to content

Conversation

@adamsitnik
Copy link
Member

It's #33505 that I would like to include in 6.0, please ignore the PR until all System.Diagnostics.Process tests are green.

@ghost
Copy link

ghost commented Aug 13, 2021

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Issue Details

It's #33505 that I would like to include in 6.0, please ignore the PR until all System.Diagnostics.Process tests are green.

Author: adamsitnik
Assignees: -
Labels:

area-System.Diagnostics.Process

Milestone: 6.0.0

@adamsitnik adamsitnik requested a review from stephentoub August 15, 2021 09:32
@ghost
Copy link

ghost commented Aug 15, 2021

Hello @adamsitnik!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 225acfe into dotnet:main Aug 15, 2021
while ((length = Interop.Kernel32.GetModuleBaseName(processHandle, moduleHandle, chars, chars.Length)) == chars.Length)
{
char[] toReturn = chars;
chars = ArrayPool<char>.Shared.Rent(length * 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it better to rent a new array first before returning the old one?

Copy link
Member

@stephentoub stephentoub Aug 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of renting and returning doesn't matter. But what does matter is the array being returned isn't referenced by the variable used for returning in the finally block. If it is, and the Return call throws after having stored the array, it could double return.

@adamsitnik adamsitnik deleted the modulePathFix branch August 16, 2021 09:38
@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants