Skip to content

Package.Open(string, ...) is more restrictive than Package.Open(stream, ...) #29237

Closed
dotnet/corefx
#38699

Description

@ericstj

We unnecessarily throw on many combinations of FileAccess for Package.Open(string, …).

See https://github.com/dotnet/corefx/blob/5023c2420a4145bcb560c4b8c57f4bb60cd6973f/src/System.IO.Packaging/src/System/IO/Packaging/Package.cs#L838-L849

The .NETCore implementation of System.IO.Packaging permits the write-only case due to the way that System.IO.Compression maintains the ZIP data in memory before writing out. We should unblock more of these cases.

In the meantime, the workaround is to open the file one-self and call Package.Open(stream, …)
https://github.com/dotnet/corefx/blob/5023c2420a4145bcb560c4b8c57f4bb60cd6973f/src/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs#L270

/cc @stevenbrix @miguep

Activity

  1. ericstj commented on Apr 11, 2019

    @ericstj
    MemberAuthor

    @karelz can you create a label for System.IO.Packaging?

  2. stephentoub commented on Apr 11, 2019

    @stephentoub
    Member

    Done

  3. karelz commented on Apr 12, 2019

    @karelz
    Member

    In general, I discourage creating areas for less than 10-20 issues. The overhead does not pay off. There are alternative ways to mark things.
    Also, we need to update the internal attribution tooling (I can help), and set up area owner - who will that be?

    I see only 7 issues in the label at the moment. Do we have more? Happy to chat about it tomorrow ...

  4. stephentoub commented on Apr 12, 2019

    @stephentoub
    Member

    The overhead does not pay off.

    What is the overhead? What area label should be used instead? Do the same developers own Packaging that own those areas?

  5. karelz commented on Apr 12, 2019

    @karelz
    Member

    Overhead:

    • Querying across multiple labels, because GH does not do OR semantics :(
    • Maintaining yet another area

    Do the same developers own Packaging that own those areas?

    Yes. Unless we have different devs in mind, it does not make sense to break it out IMO (unless it hits critical mass). And even if different devs care about it, that may not be forever and it is still a bit questionable. See for example System.Uri - packed with loagical area System.Net, using "[Uri]" prefix to mark. Not ideal, but it works.
    If there are different circumstances for System.IO.Packaging (at least different owner), then I am in ...

  6. ericstj commented on Apr 12, 2019

    @ericstj
    MemberAuthor

    System.IO.Packaging is owned by different devs than the rest of Corefx. WPF owns this

  7. karelz commented on Apr 13, 2019

    @karelz
    Member

    Are they aware of that? We need to clarify the ownership on Monday. We need to explain to them requirements and rules of the repo, etc.

  8. ericstj commented on May 30, 2019

    @ericstj
    MemberAuthor

    @stevenbrix did you still need a fix for this for WPF for 3.0 or did you use the workaround I suggested?

  9. stevenbrix commented on Jun 11, 2019

    @stevenbrix
    Contributor

    @ericstj i'm investigating this now. Is this related to https://github.com/dotnet/corefx/issues/34219? Are you suggesting that the API throws exceptions when it doesn't need to, or are there certain combinations here that don't work due to the seekability of the streams?

    If there is a workaround, we are most likely willing to make the necessary changes to use them. With that being said, I'm still in the process of validating that claim. I'm mostly interested in making sure that WPF customers aren't broken without any possible workaround.

    Another related issue to customers trying to port to .NET Core: https://github.com/dotnet/corefx/issues/25273

  10. stevenbrix commented on Jun 19, 2019

    @stevenbrix
    Contributor

    @ericstj gotcha, now i understand.

  11. stevenbrix commented on Jun 19, 2019

    @stevenbrix
    Contributor

    @ericst should they be removed, or be changed to allow FileAccess.Write?

  12. ericstj commented on Jun 19, 2019

    @ericstj
    MemberAuthor

    We can remove completely since FileStream itself will check for FileAccess.Write whenever Create is specified.

  13. transferred this issue fromdotnet/corefxon Feb 1, 2020
  14. added this to the 3.0 milestone on Feb 1, 2020
  15. ghost locked as resolved and limited conversation to collaborators on Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions