Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@ahsonkhan
Copy link

@ahsonkhan ahsonkhan commented Feb 16, 2018

return -1;

string sourceString = source.ToString();
string resultString = sourceString.ToLower(culture);
Copy link
Member

Choose a reason for hiding this comment

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

It's unfortunate we need to allocate here (potentially twice), but I don't have a better answer (unless we want to make the API netcoreapp-specific).

[Fact]
public static void Test_ToLower_Culture()
{
foreach (var testdata in ToLower_Culture_TestData())
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to use a Theory?

Copy link
Author

Choose a reason for hiding this comment

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

Probably. I borrowed this from the existing string tests and tweaked it a bit.

/// <param name="culture">An object that supplies culture-specific casing rules.</param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when <paramref name="culture"/> is null.
/// </exception>
Copy link
Member

Choose a reason for hiding this comment

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

Could you add remarks saying whether the source and destination can be overlapping (or the same span)

@ahsonkhan
Copy link
Author

@dotnet-bot test this please

@ahsonkhan ahsonkhan removed the blocked Issue/PR is blocked on something - see comments label Feb 21, 2018
@ahsonkhan
Copy link
Author

ToLower(CultureInfo) was added in netstandard2.0. What can we do for netstandard1.1?

-0d2c9ac4\bin\AnyOS.AnyCPU.Debug\System.Diagnostics.DiagnosticSource\netstandard1.1\System.Diagnostics.DiagnosticSource.dll
14:46:50 System\MemoryExtensions.Portable.cs(38,48): error CS1501: No overload for method 'ToLower' takes 1 arguments [D:\j\workspace\windows-TGrou---0d2c9ac4\src\System.Memory\src\System.Memory.csproj]
14:46:50 System\MemoryExtensions.Portable.cs(77,48): error CS1501: No overload for method 'ToUpper' takes 1 arguments [D:\j\workspace\windows-TGrou---0d2c9ac4\src\System.Memory\src\System.Memory.csproj]

@tarekgh
Copy link
Member

tarekgh commented Feb 22, 2018

@ahsonkhan you can use

CultureInfo.TextInfo.ToLower
https://msdn.microsoft.com/en-us/library/3e943zds(v=vs.110).aspx

@ahsonkhan
Copy link
Author

ahsonkhan commented Feb 22, 2018

System.Net.Http.Functional.Tests.HttpClientHandlerTest/AllowAutoRedirect_True_ValidateNewMethodUsedOnRedirection(statusCode: 307, oldMethod: "POST", newMethod: "POST", useTE: False) failed on Windows.81.Amd64.Open-Debug-x64 with Unhandled Exception of Type System.Net.Http.HttpRequestException

https://mc.dot.net/#/user/ahsonkhan/pr~2Fjenkins~2Fdotnet~2Fcorefx~2Fmaster~2F/test~2Ffunctional~2Fcli~2F/e0a26daab80419c10a37646444d5155d5495d241/workItem/System.Net.Http.Functional.Tests/analysis/xunit/System.Net.Http.Functional.Tests.HttpClientHandlerTest~2FAllowAutoRedirect_True_ValidateNewMethodUsedOnRedirection(statusCode:%20307,%20oldMethod:%20%5C%22POST%5C%22,%20newMethod:%20%5C%22POST%5C%22,%20useTE:%20False)

cc @geoffkizer, @stephentoub

System.Net.Http.HttpRequestException : Error while copying content to a stream.
---- System.IO.IOException : The write operation failed, see inner exception.
-------- System.Net.Http.WinHttpException : The connection with the server was terminated abnormally
   at System.Net.Http.HttpContent.CopyToAsyncCore(Task copyTask) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\src\System\Net\Http\HttpContent.cs:line 351
   at System.Net.Http.WinHttpHandler.InternalSendRequestBodyAsync(WinHttpRequestState state, Boolean chunkedModeForSend) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpHandler.cs:line 1361
   at System.Net.Http.WinHttpHandler.StartRequest(WinHttpRequestState state) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpHandler.cs:line 860
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\src\System\Net\Http\HttpClient.cs:line 488
   at System.Net.Http.Functional.Tests.HttpClientHandlerTest.<>c__DisplayClass51_2.<<AllowAutoRedirect_True_ValidateNewMethodUsedOnRedirection>b__1>d.MoveNext() in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\tests\FunctionalTests\HttpClientHandlerTest.cs:line 654
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Test.Common.LoopbackServer.CreateServerAsync(Func`2 funcAsync, Options options) in D:\j\workspace\windows-TGrou---74aa877a\src\Common\tests\System\Net\Http\LoopbackServer.cs:line 66
   at System.Net.Http.Functional.Tests.HttpClientHandlerTest.<>c__DisplayClass51_1.<<AllowAutoRedirect_True_ValidateNewMethodUsedOnRedirection>b__0>d.MoveNext() in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\tests\FunctionalTests\HttpClientHandlerTest.cs:line 628
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Test.Common.LoopbackServer.CreateServerAsync(Func`2 funcAsync, Options options) in D:\j\workspace\windows-TGrou---74aa877a\src\Common\tests\System\Net\Http\LoopbackServer.cs:line 66
   at System.Net.Http.Functional.Tests.HttpClientHandlerTest.AllowAutoRedirect_True_ValidateNewMethodUsedOnRedirection(Int32 statusCode, String oldMethod, String newMethod, Boolean useTE) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\tests\FunctionalTests\HttpClientHandlerTest.cs:line 612
--- End of stack trace from previous location where exception was thrown ---
----- Inner Stack Trace -----
   at System.Net.Http.HttpContent.CopyToAsyncCore(Task copyTask) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\src\System\Net\Http\HttpContent.cs:line 347
----- Inner Stack Trace -----
   at System.Environment.get_StackTrace() in D:\j\workspace\windows-TGrou---74aa877a\src\System.Runtime.Extensions\src\System\Environment.cs:line 146
   at System.Runtime.ExceptionServices.ExceptionStackTrace.AddCurrentStack(Exception exception) in D:\j\workspace\windows-TGrou---74aa877a\src\Common\src\System\Runtime\ExceptionServices\ExceptionStackTrace.cs:line 23
   at System.Net.Http.WinHttpException.CreateExceptionUsingError(Int32 error) in D:\j\workspace\windows-TGrou---74aa877a\src\Common\src\System\Net\Http\WinHttpException.cs:line 56
   at System.Net.Http.WinHttpRequestCallback.OnRequestError(WinHttpRequestState state, WINHTTP_ASYNC_RESULT asyncResult) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpRequestCallback.cs:line 324
   at System.Net.Http.WinHttpRequestCallback.RequestCallback(IntPtr handle, WinHttpRequestState state, UInt32 internetStatus, IntPtr statusInformation, UInt32 statusInformationLength) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpRequestCallback.cs:line 104
   at System.Net.Http.WinHttpRequestCallback.WinHttpCallback(IntPtr handle, IntPtr context, UInt32 internetStatus, IntPtr statusInformation, UInt32 statusInformationLength) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpRequestCallback.cs:line 47
   at Interop.WinHttp.WinHttpWriteData(SafeWinHttpHandle requestHandle, IntPtr buffer, UInt32 bufferSize, IntPtr parameterIgnoredAndShouldBeNullForAsync)
   at Interop.WinHttp.WinHttpWriteData(SafeWinHttpHandle requestHandle, IntPtr buffer, UInt32 bufferSize, IntPtr parameterIgnoredAndShouldBeNullForAsync)
   at System.Net.Http.WinHttpRequestStream.InternalWriteDataAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken token) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpRequestStream.cs:line 245
   at System.Net.Http.WinHttpRequestStream.InternalWriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken token) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpRequestStream.cs:line 203
   at System.Net.Http.WinHttpRequestStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken token) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpRequestStream.cs:line 131
   at System.Net.Http.HttpContent.CopyToAsync(Stream stream, TransportContext context, CancellationToken cancellationToken) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\src\System\Net\Http\HttpContent.cs:line 327
   at System.Net.Http.HttpContent.CopyToAsync(Stream stream, TransportContext context) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http\src\System\Net\Http\HttpContent.cs:line 310
   at System.Net.Http.WinHttpHandler.InternalSendRequestBodyAsync(WinHttpRequestState state, Boolean chunkedModeForSend) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpHandler.cs:line 1361
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in E:\A\_work\1994\s\src\mscorlib\src\System\Runtime\CompilerServices\AsyncMethodBuilder.cs:line 922
   at System.Net.Http.WinHttpHandler.InternalSendRequestBodyAsync(WinHttpRequestState state, Boolean chunkedModeForSend)
   at System.Net.Http.WinHttpHandler.StartRequest(WinHttpRequestState state) in D:\j\workspace\windows-TGrou---74aa877a\src\System.Net.Http.WinHttpHandler\src\System\Net\Http\WinHttpHandler.cs:line 860
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in E:\A\_work\1994\s\src\mscorlib\shared\System\Threading\ExecutionContext.cs:line 166
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() in E:\A\_work\1994\s\src\mscorlib\src\System\Runtime\CompilerServices\AsyncMethodBuilder.cs:line 546
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in E:\A\_work\1994\s\src\mscorlib\shared\System\Threading\ExecutionContext.cs:line 166
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) in E:\A\_work\1994\s\src\mscorlib\src\System\Threading\Tasks\Task.cs:line 2440
   at System.Threading.ThreadPoolWorkQueue.Dispatch() in E:\A\_work\1994\s\src\mscorlib\src\System\Threading\ThreadPool.cs:line 588
--- End of stack trace from AddCurrentStack ---

Edit: Filed https://github.com/dotnet/corefx/issues/27363

@ahsonkhan
Copy link
Author

@dotnet-bot test Windows x64 Debug Build

@ahsonkhan ahsonkhan added the blocked Issue/PR is blocked on something - see comments label Feb 22, 2018
@ahsonkhan
Copy link
Author

@dotnet-bot test this please

@ahsonkhan ahsonkhan removed the blocked Issue/PR is blocked on something - see comments label Feb 22, 2018
@ahsonkhan
Copy link
Author

@dotnet-bot test this please

@ahsonkhan
Copy link
Author

@dotnet-bot test Linux x64 Release Build

@ahsonkhan
Copy link
Author

Linux x64 Release Build
https://ci3.dot.net/job/dotnet_corefx/job/master/job/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/9283/

Debian.87.Amd64.Open
https://mc.dot.net/#/user/ahsonkhan/pr~2Fjenkins~2Fdotnet~2Fcorefx~2Fmaster~2F/test~2Ffunctional~2Fcli~2F/159b98e499ff9d6383d6cab1dbbeba76958bb20b/workItem/System.Net.Http.Functional.Tests/wilogs

2018-02-27 22:29:15,301: INFO: proc(54): run_and_log_output: Output:    System.Net.Http.Functional.Tests.SocketsHttpHandler_HttpClientHandlerTest.Ctor_ExpectedDefaultPropertyValues_UapPlatform [SKIP]
2018-02-27 22:29:15,302: INFO: proc(54): run_and_log_output: Output:       Condition(s) not met: \"IsUap\"
2018-02-27 22:29:15,994: INFO: proc(54): run_and_log_output: Output: /home/helixbot/dotnetbuild/work/6d7c50e0-57bf-4026-8e3f-7aa5a41c23e4/Work/86e44470-1bb0-40a6-8b54-13c0438c0a5a/Unzip/RunTests.sh: line 88: 23340 Segmentation fault      (core dumped) $RUNTIME_PATH/dotnet xunit.console.netcore.exe System.Net.Http.Functional.Tests.dll -xml testResults.xml -notrait Benchmark=true -notrait category=nonnetcoreapptests -notrait category=nonlinuxtests -notrait category=OuterLoop -notrait category=failing
2018-02-27 22:29:16,022: INFO: proc(54): run_and_log_output: Output: Dumpling has not been installed yet. Please run "DumplingHelper.py install_dumpling" before collect_dumps.
2018-02-27 22:29:16,024: INFO: proc(54): run_and_log_output: Output: ~/dotnetbuild/work/6d7c50e0-57bf-4026-8e3f-7aa5a41c23e4/Work/86e44470-1bb0-40a6-8b54-13c0438c0a5a/Unzip
2018-02-27 22:29:16,027: INFO: proc(54): run_and_log_output: Output: ----- end 22:29:16 ----- exit code 139 ----------------------------------------------------------

Centos.74.Amd64.Open
https://mc.dot.net/#/user/ahsonkhan/pr~2Fjenkins~2Fdotnet~2Fcorefx~2Fmaster~2F/test~2Ffunctional~2Fcli~2F/159b98e499ff9d6383d6cab1dbbeba76958bb20b/workItem/System.Net.NetworkInformation.Functional.Tests/wilogs

2018-02-27 22:48:40,716: ERROR: job(44): kill: Job running for too long. Killing...
2018-02-27 22:48:40,739: ERROR: executor(398): _execute_command: Executor timed out after 1200 seconds and was killed.

@ahsonkhan ahsonkhan merged commit 865f086 into dotnet:master Feb 28, 2018
@ahsonkhan ahsonkhan deleted the AddToLowerUpper branch February 28, 2018 19:09
@karelz karelz added this to the 2.1.0 milestone Mar 10, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…net/corefx#27193)

* Add ROSpan ToLower and ToUpper string-like APIs with CultureInfo

* Add comment about overlapping spans + test.

* Respond to recent change AsReadOnlySpan -> AsSpan and use Theory

* Add System.Globalization for netstandard1.1

* Use TextInfo.ToLower/ToUpper for netstandard1.1

* Fix XML comment


Commit migrated from dotnet/corefx@865f086
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.

5 participants