Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

YohDeadfall
Copy link
Contributor

Description

The proposed change is just a simple optimization of mail address collection encoding and touches only the collection type itself, not MailAddress which uses string concatenation internally in many places.

Customer Impact

A bit smaller pressure on the GC.

Regression

Nope.

Testing

Existing tests are enough to cover the change.

@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-System.Net labels Dec 7, 2023
@ghost
Copy link

ghost commented Dec 7, 2023

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

Issue Details

Description

The proposed change is just a simple optimization of mail address collection encoding and touches only the collection type itself, not MailAddress which uses string concatenation internally in many places.

Customer Impact

A bit smaller pressure on the GC.

Regression

Nope.

Testing

Existing tests are enough to cover the change.

Author: YohDeadfall
Assignees: -
Labels:

area-System.Net, community-contribution

Milestone: -

Copy link
Member

@rzikm rzikm left a comment

Choose a reason for hiding this comment

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

looks good so far, @YohDeadfall can you look into using ValueStringBuilder as huoyaoyuan suggested?

@YohDeadfall
Copy link
Contributor Author

Yup, will use it instead of the StringBuilder.

@YohDeadfall
Copy link
Contributor Author

@rzikm, could you help me with that weird error happening only for some builds?

src/libraries/System.Net.Mail/src/System/Net/Mail/MailAddressCollection.cs(54,40): error CS0122: (NETCORE_ENGINEERING_TELEMETRY=Build) 'ValueStringBuilder' is inaccessible due to its protection level

@ManickaP
Copy link
Member

ManickaP commented Jan 2, 2024

ValueStringBuilder is an internal type shared by linking the source file. You need to add it to the csproj like for example here:

<Compile Include="$(CommonPath)System\Text\ValueStringBuilder.cs"
Link="Common\System\Text\ValueStringBuilder.cs" />

@YohDeadfall
Copy link
Contributor Author

That's exactly what I did:

<Compile Include="$(CommonPath)System\Text\ValueStringBuilder.cs"
Link="Common\System\Text\ValueStringBuilder.cs" />

And it's in the same block where MailAddressCollection.cs is, no more groups where the collection is mentioned. For whatever reason it's not included in some cases while I see no directives which might control that.

@rzikm
Copy link
Member

rzikm commented Jan 2, 2024

@YohDeadfall The build failure is in unit test project, you need to include the ValueStringBuilder.cs in src\libraries\System.Net.Mail\tests\Unit\System.Net.Mail .Unit.Tests.csproj as well

This is a gimmick of some unit test projects in this repo, we compile the same source codes again as part of unit test projects in order to be able to use internal APIs for testing.

@rzikm rzikm self-assigned this Jan 2, 2024
@YohDeadfall
Copy link
Contributor Author

@rzikm, now it looks fine, thank you!

@rzikm
Copy link
Member

rzikm commented Jan 2, 2024

CI is passing, the one failure is unrelated. looks good now.

@rzikm
Copy link
Member

rzikm commented Jan 2, 2024

Thanks a lot for the patience with the contribution!

@rzikm rzikm merged commit e3d5a65 into dotnet:main Jan 2, 2024
@YohDeadfall YohDeadfall deleted the builder-instead-of-concat branch January 2, 2024 16:48
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
@karelz karelz added this to the 9.0.0 milestone May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants