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

Fix SingleFile regression in IsolatedStorageFile #42306

Closed
wants to merge 1 commit into from
Closed

Fix SingleFile regression in IsolatedStorageFile #42306

wants to merge 1 commit into from

Conversation

am11
Copy link
Member

@am11 am11 commented Sep 16, 2020

In .NET 5, (true) single file application returns:

  • a blank string from Assembly.GetEntryAssembly().Location
  • <Unknown> string from Assembly.GetEntryAssembly().ManifestModule.Name
  • System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle. from Assembly.GetEntryAssembly().assembly.CodeBase.

This change uses Process.GetCurrentProcess().MainModule.FileName for single file to fix this 3.1 -> 5.0 regression.

Fixes #42265.

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@am11 am11 marked this pull request as ready for review September 16, 2020 10:51
@am11 am11 requested a review from ericstj September 19, 2020 09:45
Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. @carlossanlop?

@carlossanlop
Copy link
Member

carlossanlop commented Oct 5, 2020

Is this unit testable, @ericstj @jkotas?

@jkotas
Copy link
Member

jkotas commented Oct 5, 2020

@agocke is working on single file unit testing #42972

@am11
Copy link
Member Author

am11 commented Oct 5, 2020

BTW, it still throws NotSupportedException with latest preview bits when -p:PublishSingleFile=true is used. I think this is a breaking change we are willing to take for 5.0?

@agocke
Copy link
Member

agocke commented Oct 5, 2020

I'm working on testing for single-file, but it likely won't be finished soon since I have to integrate with other changes to the unit testing.

However, we've agreed that this fix doesn't meet the bar for 5.0, so we won't be backporting it.

@am11
Copy link
Member Author

am11 commented Oct 5, 2020

Thanks @agocke.
for 6.0, I think we can also use the new Environment.ProcessPath API here to simplify the code.

@am11 am11 closed this Nov 29, 2020
@am11 am11 deleted the feature/singlefile/isolatedstorage branch November 29, 2020 10:38
@ghost ghost locked as resolved and limited conversation to collaborators Dec 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IsolatedStorage doesn't work from Single-File application in 5.0
7 participants