Skip to content
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

IsolatedStorage doesn't work from Single-File application in 5.0 #42265

Closed
ericstj opened this issue Sep 15, 2020 · 11 comments
Closed

IsolatedStorage doesn't work from Single-File application in 5.0 #42265

ericstj opened this issue Sep 15, 2020 · 11 comments

Comments

@ericstj
Copy link
Member

ericstj commented Sep 15, 2020

Description

Create an app using IsolatedStorage. Publish as single file.

try
{
    var store = IsolatedStorageFile.GetUserStoreForApplication();
    var file = store.CreateFile("test.txt");
    Console.WriteLine(file.Name);
}
catch (Exception e)
{
    Console.WriteLine(e);
}

Configuration

.NET 5.0
Single file publish
Tested on win-x64 but should be present everywhere.

Regression?

Yes. Worked in 3.1

Regressed by #40974

Related #42161

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-Single-File untriaged New issue has not been triaged by the area owner labels Sep 15, 2020
@ghost
Copy link

ghost commented Sep 15, 2020

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@agocke agocke added this to the 5.0.0 milestone Sep 21, 2020
@agocke agocke removed the untriaged New issue has not been triaged by the area owner label Sep 21, 2020
@agocke
Copy link
Member

agocke commented Oct 5, 2020

Mitigated by #42435

@agocke agocke modified the milestones: 5.0.0, 6.0.0 Oct 5, 2020
@am11
Copy link
Member

am11 commented Oct 5, 2020

Mitigated by #42435

I am not seeing any difference in behavior. The above repro still throws NotSupportedException with today's (two hours old) master branch and 5.0 latest preview.

@agocke
Copy link
Member

agocke commented Oct 6, 2020

Including passing the flag IncludeAllContentForSelfExtract?

@am11
Copy link
Member

am11 commented Oct 6, 2020

Yup, I tried publishing with a fresh local build of master:
dotnet publish -r osx-x64 -p:IncludeAllContentForSelfExtract=True -p:PublishSingleFile=True -c Release

throws:

System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle.
   at System.Reflection.RuntimeAssembly.get_CodeBase()
   at System.IO.IsolatedStorage.Helper.GetDefaultIdentityAndHash(Object& identity, String& hash, Char separator)
   at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
   at System.IO.IsolatedStorage.IsolatedStorageFile..ctor(IsolatedStorageScope scope)
   at System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication()
   at isolated.Program.Main(String[] args)

revision:

$ strings /Users/am11/projects/runtime_base/.dotnet2/dotnet 2>&1 | grep Commit
@(#)Version 42.42.42.42424 @Commit: 30e643e2f2433055d6ed433af38a925ee657d4ad

@agocke
Copy link
Member

agocke commented Oct 7, 2020

Looks like the 6.0 installer builds have been blocked for quite a while now. Testing locally, looks like CodeBase works appropriately in 5.0 RTM.

@am11
Copy link
Member

am11 commented Oct 7, 2020

Confirmed. With 5.0.100-rtm.20506.2 (runtime: 30e643e), it does not throw NotSupportedException. If there is no further action required, shall we close this issue and #42306?

@carlossanlop
Copy link
Member

Confirmed. With 5.0.100-rtm.20506.2 (runtime: 30e643e), it does not throw NotSupportedException. If there is no further action required, shall we close this issue and #42306?

@ericstj do we still want to merge the PR #42306 to main? Would we be interested in backporting it to 5.0 at some point? I ask because @agocke mentioned that #42435 was a mitigation, but not the actual fix.

@ericstj
Copy link
Member Author

ericstj commented Oct 13, 2020

Yes merging to master is fine. We can service to 5.0 if anyone is blocked and can’t use the workaround.

@kostasvl
Copy link

Hi. This occurs for me on 5.0.203. It's a WPF app, published via ClickOnce, single file, self-contained.

System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle.
at System.Reflection.RuntimeAssembly.get_CodeBase()
at System.IO.IsolatedStorage.Helper.GetDefaultIdentityAndHash(Object& identity, String& hash, Char separator)
at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorageFile..ctor(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetMachineStoreForApplication()
at MyApp.App.Application_Startup(Object sender, StartupEventArgs e)

@agocke
Copy link
Member

agocke commented Aug 2, 2021

Should be resolved in 6.0

@agocke agocke closed this as completed Aug 2, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants