Is there an existing issue for this?
Task description
There are currently several issues with the implementation of FileSupport.GetCanonicalPath(), which is mostly a port from Apache Harmony. This method is on a required path for nearly all users, so it would be good to ensure that it is optimized and fully functional.
Is there an existing issue for this?
Task description
There are currently several issues with the implementation of
FileSupport.GetCanonicalPath(), which is mostly a port from Apache Harmony. This method is on a required path for nearly all users, so it would be good to ensure that it is optimized and fully functional.nullcheck, which should throwArgumentNullException0byte at the end, converting to string, then removing the trailing\0character that the0byte creates. It would be better just to omit the null character from the buffer.LUCENENET TODOfor it in the code).GetOrAdd()method already allows racing threads to both run the business logic without blocking. If we move the logic that builds the string into the factory parameter of this method, we can eliminate the extraTryGetValue()check (and the unnecessary check for anullstring in the collection).Encodingthat accepts aSpan<byte>so we can allocate the temporary buffer on the stack on all supported target frameworks.