Skip to content

Update Path.GetTempPath description #10118

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

Merged
merged 7 commits into from
Jul 29, 2024
Merged

Update Path.GetTempPath description #10118

merged 7 commits into from
Jul 29, 2024

Conversation

adamsitnik
Copy link
Member

Recently we have backported dotnet/runtime#72452 to all supported versions of .NET and .NET Framework.

fixes dotnet/runtime#105012

@adamsitnik adamsitnik requested a review from a team as a code owner July 17, 2024 13:12
@ghost ghost added the area-System.IO label Jul 17, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io

Copy link

Learn Build status updates of commit 48ec09b:

✅ Validation status: passed

File Status Preview URL Details
xml/System.IO/Path.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

Co-authored-by: Genevieve Warren <[email protected]>
@adamsitnik adamsitnik requested a review from gewarren July 18, 2024 13:55
Copy link

Learn Build status updates of commit 97f2c48:

✅ Validation status: passed

File Status Preview URL Details
xml/System.IO/Path.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit 7fd711d:

✅ Validation status: passed

File Status Preview URL Details
xml/System.IO/Path.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

Co-authored-by: Theodore Tsirpanis <[email protected]>
Copy link

Learn Build status updates of commit 4748704:

✅ Validation status: passed

File Status Preview URL Details
xml/System.IO/Path.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@GrabYourPitchforks
Copy link
Member

the method skips the preceding sequence and returns C:\Windows\SystemTemp

@adamsitnik Just to be pedantic, there are some cases where GetTempPath2 will return a directory other than %WINDIR%\SystemTemp. It might be worthwhile for us to link directly to https://learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-gettemppath2w rather than try to keep our docs up to date with them. This also makes us more future proof in case the OS updates the behavior going forward.

if your operating system is Windows 11 or Windows Server build 20348 or later

AFAIK we don't perform an OS version check. We simply look for the existence of the export. This is another case where we should link to the authoritative documentation for the underlying Win32 function rather than trying to duplicate it ourselves (and risk getting out of sync if they make a change regarding available versions).

@Mafii
Copy link

Mafii commented Jul 19, 2024

AFAIK we don't perform an OS version check.

That is true, but the change in .NET Framework (4.8.*) was not included in earlier builds of Windows, even if the GetTempPath2 API was available, as Windows ships .NET Framework itself.

For example, my co-worker has a Windows 11, Build 22631.3737, and the behaviour of C# applications targeted at net48 is different on his machine than on mine, which is Windows 11, Build 22631.3880. So just mentioning the presence of the GetTempPath2 API is not sufficient for .NET Framework (it is for .NET 6.0.32+...).

I agree linking the win32 API docs would be an improvement.

@GrabYourPitchforks
Copy link
Member

Feedback from netfx servicing:

  • Do not include the compat switch in the Learn docs. Documenting it gives the false impression that the team is committed to keeping the switch around in its current state indefinitely. Additionally, ownership of this rests with CSS, and we should allow them to be in charge of their own communication channel. (Typically CSS publishes these switches in a KB article if needed, not in the API docs.)
  • We should update the docs to reflect all frameworks this change is applicable to. But it's not up to API docs to say when the change came in, because we should optimize for the world where the change rolls out in rapid fashion and almost everybody coming to these docs already has the changes pulled down.
  • We should remove from the docs anything that we do not implement ourselves. For example, since we do not read env vars, we should not document them. Instead, link to an authoritative source of how our dependencies operate and make that doc team responsible for keeping the documentation up to date.

I'll send shortly a new iteration with includes these changes and merges Genevieve's recommendations.

Copy link

Learn Build status updates of commit 8d7b7ab:

✅ Validation status: passed

File Status Preview URL Details
xml/System.IO/Path.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@gewarren
Copy link
Contributor

@adamsitnik
Copy link
Member Author

I'll send shortly a new iteration with includes these changes and merges Genevieve's recommendations.

Thank you @GrabYourPitchforks !

Co-authored-by: Genevieve Warren <[email protected]>
@GrabYourPitchforks GrabYourPitchforks enabled auto-merge (squash) July 29, 2024 21:03
Copy link

Learn Build status updates of commit 88a640d:

✅ Validation status: passed

File Status Preview URL Details
xml/System.IO/Path.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@GrabYourPitchforks GrabYourPitchforks merged commit e58c2ef into main Jul 29, 2024
3 checks passed
@GrabYourPitchforks GrabYourPitchforks deleted the getemppath2 branch July 29, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undocumented Change in behavior for GetTempPath in .NET 6.0.32 and Framework 4.8.1
7 participants