Do not verify existence of LocalApplicationData directory in dotnetup#54516
Conversation
…DotnetupTelemetry
baronfel
left a comment
There was a problem hiding this comment.
LGTM!
Style nit (for dotnetup, not your change specifically): I don't like how default-path computation is so spread out - feels like we had to whack-a-mole a bit to find all the places that could hit this issue. Could/should these be centralized/co-located?
There was a problem hiding this comment.
Pull request overview
Fixes dotnetup crashing on minimal Linux environments where ~/.local/share doesn't exist by using Environment.SpecialFolderOption.DoNotVerify when resolving LocalApplicationData, so the path is computed rather than returned as empty. Directory creation is already deferred to write-time helpers.
Changes:
DotnetupPaths.GetBaseDirectory()now passesDoNotVerify.DotnetupTelemetry.s_defaultStorageDirectorynow passesDoNotVerify.DownloadCachedefault cache path now passesDoNotVerify, with a comment explaining why it can't reuseDotnetupPaths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Installer/dotnetup.Library/DotnetupPaths.cs | Primary fix: resolve LocalApplicationData without verifying existence. |
| src/Installer/dotnetup.Library/Telemetry/DotnetupTelemetry.cs | Same fix applied to the telemetry default storage directory. |
| src/Installer/Microsoft.Dotnet.Installation/Internal/DownloadCache.cs | Same fix applied to default download cache path; added comment explaining layering. |
I think you could easily have everything centralized if you:
|
Fixes:
Supersedes #54510