Description
Description
We have a cross platform application running on Windows and Linux and we noticed a difference between the
ChangeExtension implementation on the two platforms. On Windows calling ChangeExtension with an empty string results in the extension being removed. e.g. "file.extension" becomes "file" but on Linux we get "file."
On windows it must be running the framework version of this code but on Linux we get the core runtime implementation.
Reproduction Steps
Run Path.ChangeExtension("file.extension", "") on Windows and Linux
Expected behavior
The extension is removed leaving a bare file name with no trailing '.'
Actual behavior
The extension is removed leaving a trailing '.'
Regression?
This works as described in .NET Framework
Known Workarounds
Users can use Path.RemoveExtension instead when removing, but if you are adding an optional extension the only workaround is to add a test for empty before using the method
Configuration
No response