Skip to content

Use ImmutableArray<string> instead of string for arguments#45222

Merged
4 commits merged intodotnet:masterfrom
davkean:AvoidLOH
Jul 29, 2020
Merged

Use ImmutableArray<string> instead of string for arguments#45222
4 commits merged intodotnet:masterfrom
davkean:AvoidLOH

Conversation

@davkean
Copy link
Member

@davkean davkean commented Jun 16, 2020

Fixes: #32594.

This converts from a flat string to represent the command-line to an ImmutableArray to avoid the string ending up on the LOH.

@davkean davkean requested a review from a team as a code owner June 16, 2020 06:13
@jasonmalinowski jasonmalinowski self-assigned this Jun 16, 2020
@jasonmalinowski
Copy link
Member

@davkean High level approach looks good; commented on a few places where a few bugs popped out but didn't do a careful review.

@CyrusNajmabadi
Copy link
Contributor

I have no issue with this.

@jasonmalinowski jasonmalinowski marked this pull request as draft June 25, 2020 18:55
@jasonmalinowski
Copy link
Member

@davkean I've marked this as draft so it's not on our review list, once you're ready for us to take this just let us know.

@davkean davkean changed the title Use IEnumerable<string> instead of string for arguments Use ImmutableArray<string> instead of string for arguments Jul 2, 2020
@davkean davkean marked this pull request as ready for review July 3, 2020 00:25
@davkean
Copy link
Member Author

davkean commented Jul 3, 2020

@jasonmalinowski @CyrusNajmabadi This is ready for re-review. I've tested this, including the ruleset changing on disk path and it works great.

@davkean davkean force-pushed the AvoidLOH branch 2 times, most recently from a5f05e9 to cbab02d Compare July 6, 2020 05:24
Fixes: dotnet#32594.

This converts from a flat string to represent the command-line to an ImmutableArray<string> to avoid the string ending up on the LOH.
using Roslyn.Test.Utilities;
using Xunit;

#pragma warning disable CS0618 // Testing obsolete overload
Copy link
Member

Choose a reason for hiding this comment

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

Can we move the tests to the non-obsolete overload?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would miss coverage.

Copy link
Member

Choose a reason for hiding this comment

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

I guess if we want to cover the obsolete methods we probably should do so more intentionally, but I assume we're ripping this out as soon as you switch to it...

Copy link
Member Author

Choose a reason for hiding this comment

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

Legacy will always call this method.

Copy link
Member

Choose a reason for hiding this comment

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

At least by name these are the CPS tests though -- should we get a copy of the tests then testing through the old interface too?

@jasonmalinowski
Copy link
Member

@davkean Is this waiting on anything else at this point other than the test coverage concern?

@davkean
Copy link
Member Author

davkean commented Jul 27, 2020

I've changed the tests methods to call through the new API.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

@ghost ghost merged commit bd49f95 into dotnet:master Jul 29, 2020
@ghost ghost added this to the Next milestone Jul 29, 2020
@RikkiGibson RikkiGibson modified the milestones: Next, 16.8.P2 Aug 11, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change IWorkspaceProjectContext.SetOptions to take an IEnumerable<string>

5 participants