Skip to content

Use preferred overloads of string.Split()#23712

Merged
Tratcher merged 2 commits intodotnet:masterfrom
martincostello:Use-StringSplitOptions-TrimEntries
Jul 6, 2020
Merged

Use preferred overloads of string.Split()#23712
Tratcher merged 2 commits intodotnet:masterfrom
martincostello:Use-StringSplitOptions-TrimEntries

Conversation

@martincostello
Copy link
Member

Use preferred overloads of string.Split() to leverage changes from dotnet/runtime#35740 (#23683 (comment))

@Tratcher
Copy link
Member

Tratcher commented Jul 6, 2020

Looks like we don't have TrimEntries yet?

@martincostello
Copy link
Member Author

Hmm - I wonder why I had it in my Intellisense locally?

I've not been doing full builds locally as I've been getting weird errors about missing VC stuff for the IIS module locally, which has been causing me compilation issues, so I didn't spot this error.

@pranavkm
Copy link
Contributor

pranavkm commented Jul 6, 2020

I've not been doing full builds locally as I've been getting weird errors about missing VC stuff for the IIS module locally,

@martincostello, I've also seen this on my dev box. Running .\build -native resolves it, but of course is really frustrating to do. FYI @dougbu

if (sinksFromRegistry != null)
{
foreach (string sinkFromRegistry in sinksFromRegistry.Split(';'))
foreach (string sinkFromRegistry in sinksFromRegistry.Split(';', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
Copy link
Contributor

Choose a reason for hiding this comment

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

This project cross-compiles to ns2.0. I'd leave this be

}

var authTypesSplit = authorizeDatum.AuthenticationSchemes?.Split(',');
var authTypesSplit = authorizeDatum.AuthenticationSchemes?.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
Copy link
Contributor

Choose a reason for hiding this comment

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

Also multi-targets ns2.0. Probably better to undo than use ifdefs

@martincostello
Copy link
Member Author

@martincostello, I've also seen this on my dev box. Running .\build -native resolves it, but of course is really frustrating to do.

Thanks, build.cmd -nobuildnative fixed it for me.

Revert usage of StringSplit.TrimEntries for projects that target netstandard2.0.
@pranavkm pranavkm added this to the 5.0.0-preview8 milestone Jul 6, 2020
Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

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

Thanks @martincostello. I did not know of this API until you sent the PR.

@pranavkm
Copy link
Contributor

pranavkm commented Jul 6, 2020

@Tratcher are you happy with the hosting changes?

@Tratcher Tratcher merged commit fd1f1c3 into dotnet:master Jul 6, 2020
@Tratcher
Copy link
Member

Tratcher commented Jul 6, 2020

Thanks

@martincostello martincostello deleted the Use-StringSplitOptions-TrimEntries branch July 7, 2020 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants