Uh oh!
There was an error while loading. Please reload this page.
Add public methods that remove path redundant segments - #2187
Add public methods that remove path redundant segments#2187carlossanlop wants to merge 7 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
MihaZupan
commented
Jan 27, 2020
The purpose of |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
carlossanlop
commented
Feb 20, 2020
I'll close this issue while it's in draft mode. I'll reopen when the unit tests are ready. |
carlossanlop
commented
Feb 22, 2020
jkotas
commented
Feb 22, 2020
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
ValueStringBuilder is meant to be used with stackallocated buffer for sizes up to certain limit. Getting a pooled buffer has too much overhead for small buffers.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
@JeremyKuhne - I'm investigating these tests where I put a comment next to them, because their behavior was slightly different than expected.
I also noticed the resulting path is different in Windows than in Unix, because of the separator char used.
There was a problem hiding this comment.
I talked with Jeremy about the expected behavior on each edge case. I am adding tests to verify them.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Currently blocked by a bug I found in |
…rt type 'string' to 'System.ReadOnlySpan<char>'.
…he span overloads of GetPathRoot and IsPathFullyQualified inside PathInternal.
| if (string.IsNullOrEmpty(path)) | ||
| return path; | ||
| Span<char> destination = stackalloc char[path.Length]; |
There was a problem hiding this comment.
Unbounded stackallocs are prohibited in dotnet/runtime libraries
There was a problem hiding this comment.
@stephentoub I don't see record of a discussion about trying to catch this with an analyzer. It's not generally possible to be sure (either way) whether it's unbounded. But an analyzer that forced a pattern of passing a constant value would be doable.
Looking at all our stackallocs, almost all of them already pass a constant directly or via a constant field or local. The few exceptions are not self evidently safe by eyeball, eg.,
privatestaticunsafeintEncryptDecryptHelper(OPop,ISSPIInterfacesecModule,SafeDeleteContextcontext,Span<SecurityBuffer>input,uintsequenceNumber){Interop.SspiCli.SecBufferDescsdcInOut=newInterop.SspiCli.SecBufferDesc(input.Length);Span<Interop.SspiCli.SecBuffer>unmanagedBuffer=stackallocInterop.SspiCli.SecBuffer[input.Length];and it would be easy for one of them to be wrong. Would it be reasonable to have an analyzer that required them to be rewritten in constant terms, or at least something the analyzer could recognize like
Span<Interop.SspiCli.SecBuffer>unmanagedBuffer=stackallocInterop.SspiCli.SecBuffer[Math.Min(input.Length,BufferSize)];carlossanlop
commented
May 2, 2020
I'll close this while I address the Unix failures. |
Fixes#2162