-
Notifications
You must be signed in to change notification settings - Fork 5k
Breaking change: The behaviour of System.IO.Path.GetFullPath has changed for some reserved filenames. #78834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsDescriptionCompare the two invocations of Both sample systems are x64. On a sample Win 10 system:
On a sample Win 11 system:
Reproduction StepsSee above. Expected behavior
Actual behavior
Regression?Yes, it is a regression. Known WorkaroundsNo response ConfigurationSee description. Other informationNo response
|
Could you try sooner older .NET Core versions to narrow down when it changed? |
I've realised I might have put this in the wrong repo. I'm encountering the issue with .NET Framework 4.x - and hence the challenge with identifying exactly what part of the Windows installation has caused the change. If this is the wrong repo, could an admin move it if possible, or advise and I'll repost in the correct repo. |
For what it's worth, I get the "c:" result for all versions of .NET Framework and .NET Core on my machine. Could it depend on what serial ports exist on the machine (from the OS point of view) and how they are registered? I am guessing that .NET Core behaves the same as .NET Framework on whatever machine is hitting this, is that right? What does Also, is this breaking something or are you just curious? |
@danmoseley try it with |
I used 2.0. It is side by side. |
Anyway, I found the relevant change in the OS. It makes the code within GetFullPathNameW be more strict when it decides whether an input is a legacy DOS device name. Previously, extensions were ignored, now they are not. The change was apparently to make it possible to work with files from other OS, eg., in the Linux kernel repo there is a file named aux.c. As you suspected, it's not a change in .NET. Shall we close this? |
Ok! Now that's what I call checking for a regression...
Do you know what footprint (eg, OS version) this change has? It would be interesting and useful to know.
Given that methods like |
@tg73 missed your comment. We'd welcome a PR to improve the doc if you would like. (click pencil icon or edit button on doc page) |
Description
Compare the two invocations of
System.IO.Path.GetFullPath( "COM3.1.txt" )
detailed below. One returns\\.\COM3
, the other returnsC:\COM3.1.txt
. The older system returns\\.\COM3
as our code expects, the newer system does not. This is a breaking change. I am not able to determine exactly what is responsible for this change - it could be the netfx version, the OS version, or some windows update. The filenameCOM3.1.txt
is used as an example, but other variations are affected in the same way, for exampleCOM3.txt
,COM1.txt
,PRN.txt
.Both sample systems are x64.
On a sample Win 10 system:
On a sample Win 11 system:
Reproduction Steps
See above.
Expected behavior
System.IO.Path.GetFullPath( "COM3.1.txt" )
should return\\.\COM3
, as it has done historically.Actual behavior
System.IO.Path.GetFullPath( "COM3.1.txt" )
returnsC:\COM3.1.txt
on some likely more-modern or more-updated environments.Regression?
Yes, it is a regression.
Known Workarounds
No response
Configuration
See description.
Other information
No response
The text was updated successfully, but these errors were encountered: