-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
74642 change isostorage path #75541
74642 change isostorage path #75541
Conversation
Tagging subscribers to this area: @dotnet/area-system-io Issue Detailsnull
|
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
{ | ||
private string GetIsolatedStorageRoot() | ||
{ | ||
return Helper.GetRootDirectory(Scope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the mono
implementation you linked the code appends .isolated-storage
at the very end and I can't see it anywhere in your PR. Is that done somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is done in https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.Win32Unix.cs#L26 ,https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.cs#L8
but thanks for noticing I need to change to previous name as now it will be /IsolatedStorage/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the latest change will change the behavior of all platforms, not just the mobile ones, right? I'm not sure if that's something we can/should do, because it could lead to the same problem just on different platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does .config
get appended to the path on mobile if IsolatedStorageDirectoryName
is just .isolated-storage
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in all cases config is appended
( in legacy mono also https://github.com/mono/mono/blob/b40e9939a7d07b30a75625692874f02bcc9be18f/mcs/class/corlib/System/Environment.cs#L623 ). During testing I noticed in some cases there was .config added and I think it was done by GetDataDirectory , it will be included in dataDirectory https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.Win32Unix.cs#L26
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -5,22 +5,22 @@ namespace System.IO.IsolatedStorage | |||
{ | |||
internal static partial class Helper | |||
{ | |||
private const string IsolatedStorageDirectoryName = "IsolatedStorage"; | |||
private const string IsolatedStorageDirectoryName = ".isolated-storage"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change apply to all configurations? If so, we need to make it mobile specific as to not break everyone else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does seem like this file is used by non-mobile platforms as well. I saw that in the original issue discussion, .config/.isolated-storage
was mentioned primarily as a workaround to access legacy files (files created when the App was using Xamarin instead of .net 6) to then call System.IO.File.
Is the change IsolatedStorage
-> .isolated-storage
to address accessing files created by the App when it was running on legacy code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
/// and a set of random directory names if not roaming. (The random directories aren't created for WinRT as | ||
/// the FolderPath locations for WinRT are app isolated already.) | ||
/// | ||
/// Examples: | ||
/// | ||
/// User: @"C:\Users\jerem\AppData\Local\IsolatedStorage\10v31ho4.bo2\eeolfu22.f2w\" | ||
/// User|Roaming: @"C:\Users\jerem\AppData\Roaming\IsolatedStorage\" | ||
/// Machine: @"C:\ProgramData\IsolatedStorage\nin03cyc.wr0\o3j0urs3.0sn\" | ||
/// User|Roaming: @"C:\Users\jerem\AppData\Roaming\.isolated-storage\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would provide an iOS and Android example as opposed to windows paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
src/libraries/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
Outdated
Show resolved
Hide resolved
...ies/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.NonMobile.cs
Show resolved
Hide resolved
@@ -5,22 +5,22 @@ namespace System.IO.IsolatedStorage | |||
{ | |||
internal static partial class Helper | |||
{ | |||
private const string IsolatedStorageDirectoryName = "IsolatedStorage"; | |||
private const string IsolatedStorageDirectoryName = ".isolated-storage"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does seem like this file is used by non-mobile platforms as well. I saw that in the original issue discussion, .config/.isolated-storage
was mentioned primarily as a workaround to access legacy files (files created when the App was using Xamarin instead of .net 6) to then call System.IO.File.
Is the change IsolatedStorage
-> .isolated-storage
to address accessing files created by the App when it was running on legacy code?
@@ -45,7 +45,7 @@ public void GetDataDirectory(IsolatedStorageScope scope) | |||
return; | |||
|
|||
string path = Helper.GetDataDirectory(scope); | |||
Assert.Equal("IsolatedStorage", Path.GetFileName(path)); | |||
Assert.Equal(".isolated-storage", Path.GetFileName(path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are keeping IsolatedStorage
on non-mobile platforms, we can have different assert expectations for mobile/non-mobile, or a test to be ran on mobile and a test to be ran on non-mobile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine)); | ||
} | ||
|
||
s_roots = GetRoots(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What tests are failing if this isn't changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As roots are different for mobile and non mobile platforms I needed to implement differently for them.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -5,14 +5,14 @@ namespace System.IO.IsolatedStorage | |||
{ | |||
internal static partial class Helper | |||
{ | |||
private const string IsolatedStorageDirectoryName = "IsolatedStorage"; | |||
public static string IsolatedStorageDirectoryName { get; set;} = "IsolatedStorage"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can have a Helper.AnyMobile.cs and a Helper.NonMobile.cs that has the old string const behavior and you would not need to have an Initialize method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outside of my one comment, I think it looks good.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we shouldn't just remove the generated hash identity like this (i.e. removing IdentityHash
). Thats the Url.j1gfq4nxq1m4zfi31rjvtcuna3umf3fb
in the file path of the reported issues' description right? It feels like the identity hash would prevent some sort of collision, but I'm not certain. I'm imagining something like two different applications that just so happen to store their own version of a file file.txt
and that the IdentityHash helps distinguish the files so that they wouldn't be unwantedly modified by a different app. If this is the case, then it seems like a bug for iOS that should be fixed (since it was stated that the hash stays the same on Android).
On disk, each app has it's own directory, so I'm not concerned about collisions between different apps. |
/backport to release/7.0 |
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3137018195 |
@mkhamoyan, I am looking at runtime outerloop failures. Have you checked the test failures in
|
This PR doesn't appear to have anything to do with the suites you listed. Are they tvOS failures? If so, can you provide a link to where you are looking? I believe they may be known intermittent issues with devices and not problems with tests. |
The path of a file created by IsolatedStorageFile.GetUserStoreForApplication() changes between Xamarin.iOS and .NET 6, and also changes between different builds of the application under .NET 6.
Switched back to the .isolatedstorage approach we had in legacy mono https://github.com/mono/mono/blob/main/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs#L304-L327
Fix #74642