You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When porting System.IO.Packaging over to .NET Core, two features interrelated features were dropped: Streaming mode (which allows creation of interleaved parts), and support for reading/updating existing interleaved parts.
The reason they were dropped was because the porter was under instruction to replatform the the code to use System.IO.Compression, instead of MS.Internal.IO.Zip. Since at the time, a major goal was still to keep the runtime size small by avoiding duplicated code, this made sense.
However, part of the support for interleaved files (which is specific to Open Packaging Conventions) was implemented in the MS.Internal.IO.Zip namespace, and therefore was not ported, even though it could have been moved into to Packaging namespace where I would argue it should have been in the first place, and updated to be based on System.IO.Compression, just like the rest of the OPC specific code.
This issue is basically requesting to restore the missing support for reading and updating interleaved files. The read and update support actually has no public API surface (unlike streaming), and its absence is a correctness issue, since support for reading interleaved OPC files is not optional in the specification. On the other hand, the ability to produce such files is optional, since interleaving is only meant as a possible performance enhancement, so restoring streaming mode is less important.
It appears that all the needed code has been released under MIT, either as part of the initial commit of the code to this repository (where unfortunately, it had already been heavily modified from the original, so hopefully no needed code was removed, but it looks like most was just ifdefed out), or for the MS.Internal.IO.Zip code needed, was released as part of open sourcing WPF, although the code was deleted in later commits due to not being used by anything over there.
Reacted by Jan Kučera, Maximilian Haru Raditya and Nick Westgate
It is up to the area owners to decide if restoring such support is code they are willing to have and maintain. If it is then somebody needs to port the code, which while probably not hard, is also not completely trivial.
Given that .NET 6 is already full in terms of planned projects, it would be unlikely to happen for that release unless a contributor creates a pull request. The chances of this being backported to older releases is pretty much zero, although as an OOB package, one ought to be able to reference a newer version from older net core based frameworks.
Perhaps @carlossanlop or one of the other area owners can comment if a pull request fixing this regression vs .NET Framework (which is technically also a correctness issue) by porting the missing code might be accepted. As mentioned before there is no associated public API change. Instead, Zip-based OPC packages with interleaved parts would simply have those parts be visible again if opened with this package. Right now, such parts get silently ignored, which is not even easy for apps to detect is happening, unless they see a required part is missing or look in the zip file themselves.
Could this be achieved by using the code in a non Microsoft owned project?
Is there a way to get a sense of the level of interest in this feature, such that it would justify the cost of maintenance etc?
I'm currently working on this, and hopefully there should be a PR ready for review "soon" - probably the next week or so, realistically. I'm adding test coverage for the new functionality as I go, but it doesn't do much to test the existing code. That particular gap should be triaged separately IMO.
It's possible to control whether or not the XPS Document Writer printer triggers this behaviour, which makes it easier to test with real files. In the printer's advanced printing preferences, the interleaving option can be toggled off or on (the default behaviour is off.) Of course, this doesn't help particularly if you're not in control of the files you receive!
Thanks. I briefly tested with file 02 outside of the automatic tests, and was able to enumerate, read and write its package parts.
There are definitely performance and functionality improvements to be made from ZipArchive upwards. Some of the largest improvements need an API review, but I think they're ultimately necessary. I'd personally like to see async support in ZipArchive, some memory usage reductions, and to move thumbnails and digital signatures from XpsDocument to Package - they're part of the base OPC specification, and Office documents (and possibly NuGet packages and VSIX extensions) use them.
I don't know about .NET 6, but I'd be surprised if any new functionality was backported to .NET 7. MS' support lifecycle puts .NET 7 in Maintenance support, in which only security fixes are made.
The process for requesting a backport is found here. It reads to me like you'll need to wait for the current PR to be merged, then raise a second PR requesting its backport.
I think it is unlikely for backports to be approved for this, but it also shouldn't be needed at least longer term, as if accepted it will become part of the System.IO.Packaging nuget that targets .NET Standard 2.0, so any impacted .NET 6 or .NET 7 or .NET 8 project should be able to just reference the 9.0 version of the package to add this functionality back.
Unfortunately that NuGet probably won't contain builds targeting 6 or 7, so the .NET Standard 2.0 build would get used, I'd expect that would merely impact performance rather than functionality, and the resulting performance we are talking about here should still be at .NET Framework level or better, so quite unlikely to be a showstopper.
.net 6 would be great but not necessary. Backport to .net 7 would be needed.
The problem is that some clients (gov, fortune500, ..) cannot install newer (internally not approved) .net releases on some servers, and at least not .net 8 / .net 9 (some even require that a release needs to be on the market for 6months or 1 year already to be approved as "ok" or "stable") That is why I asked if this will be backported so that we could roll this out to some customers. Minor releases from an approved framework version are faster accepted.
🙄
Appreciate already what you are doing! Let's make XPS great again 👍
Activity
KevinCathcart commentedon May 9, 2021
When porting System.IO.Packaging over to .NET Core, two features interrelated features were dropped: Streaming mode (which allows creation of interleaved parts), and support for reading/updating existing interleaved parts.
The reason they were dropped was because the porter was under instruction to replatform the the code to use System.IO.Compression, instead of MS.Internal.IO.Zip. Since at the time, a major goal was still to keep the runtime size small by avoiding duplicated code, this made sense.
However, part of the support for interleaved files (which is specific to Open Packaging Conventions) was implemented in the MS.Internal.IO.Zip namespace, and therefore was not ported, even though it could have been moved into to Packaging namespace where I would argue it should have been in the first place, and updated to be based on System.IO.Compression, just like the rest of the OPC specific code.
This issue is basically requesting to restore the missing support for reading and updating interleaved files. The read and update support actually has no public API surface (unlike streaming), and its absence is a correctness issue, since support for reading interleaved OPC files is not optional in the specification. On the other hand, the ability to produce such files is optional, since interleaving is only meant as a possible performance enhancement, so restoring streaming mode is less important.
It appears that all the needed code has been released under MIT, either as part of the initial commit of the code to this repository (where unfortunately, it had already been heavily modified from the original, so hopefully no needed code was removed, but it looks like most was just ifdefed out), or for the MS.Internal.IO.Zip code needed, was released as part of open sourcing WPF, although the code was deleted in later commits due to not being used by anything over there.
wstaelens commentedon May 10, 2021
ok @KevinCathcart thanks for explaining in detail.
What does it mean for us now? Will it be added again to .NET Core /.NET 5?
KevinCathcart commentedon May 10, 2021
It is up to the area owners to decide if restoring such support is code they are willing to have and maintain. If it is then somebody needs to port the code, which while probably not hard, is also not completely trivial.
Given that .NET 6 is already full in terms of planned projects, it would be unlikely to happen for that release unless a contributor creates a pull request. The chances of this being backported to older releases is pretty much zero, although as an OOB package, one ought to be able to reference a newer version from older net core based frameworks.
Perhaps @carlossanlop or one of the other area owners can comment if a pull request fixing this regression vs .NET Framework (which is technically also a correctness issue) by porting the missing code might be accepted. As mentioned before there is no associated public API change. Instead, Zip-based OPC packages with interleaved parts would simply have those parts be visible again if opened with this package. Right now, such parts get silently ignored, which is not even easy for apps to detect is happening, unless they see a required part is missing or look in the zip file themselves.
wstaelens commentedon May 19, 2021
🤞 @carlossanlop
wstaelens commentedon Oct 28, 2021
@jozkee @carlossanlop @KevinCathcart @GrabYourPitchforks any updates? 🥺
wstaelens commentedon Feb 9, 2022
🥺 🤞 😭
wstaelens commentedon Jun 21, 2022
@carlossanlop @jozkee what's the status of this?
danmoseley commentedon Jun 21, 2022
Could this be achieved by using the code in a non Microsoft owned project?
Is there a way to get a sense of the level of interest in this feature, such that it would justify the cost of maintenance etc?
15 remaining items
wstaelens commentedon Sep 19, 2023
@ericstj what is the status? Can you make a push for .net 8 or do we have to wait another release?
davidfowl commentedon Sep 19, 2023
.NET 8 is done.
wstaelens commentedon Sep 19, 2023
😞 27-06-2016 - ... 2024? 2025? 7+ years have passed since .net core release without any fixes. fingers crossed...?
wstaelens commentedon Jan 30, 2024
what is the status of this for .net 9 ?
edwardneal commentedon Jan 30, 2024
I'm currently working on this, and hopefully there should be a PR ready for review "soon" - probably the next week or so, realistically. I'm adding test coverage for the new functionality as I go, but it doesn't do much to test the existing code. That particular gap should be triaged separately IMO.
It's possible to control whether or not the XPS Document Writer printer triggers this behaviour, which makes it easier to test with real files. In the printer's advanced printing preferences, the interleaving option can be toggled off or on (the default behaviour is off.) Of course, this doesn't help particularly if you're not in control of the files you receive!
wstaelens commentedon Feb 5, 2024
@edwardneal you can find test documents here:
you can find some test files here from the xps jobs:
dotnet/wpf#3546 (comment)
In general, XPS still uses arraylists and code base could be improved. I often use this 900+ test document:
https://spaenhiers.files.wordpress.com/2022/10/bidprentjes_2022-10-20.pdf
imagine the performance boost if the STA thread requirement could be dropped.
edwardneal commentedon Feb 5, 2024
Thanks. I briefly tested with file 02 outside of the automatic tests, and was able to enumerate, read and write its package parts.
There are definitely performance and functionality improvements to be made from ZipArchive upwards. Some of the largest improvements need an API review, but I think they're ultimately necessary. I'd personally like to see async support in ZipArchive, some memory usage reductions, and to move thumbnails and digital signatures from XpsDocument to Package - they're part of the base OPC specification, and Office documents (and possibly NuGet packages and VSIX extensions) use them.
wstaelens commentedon Feb 8, 2024
@edwardneal will these changes be backported to .net 6 and .net 7 (as some of our customers are stuck for months/years on .net 6/7....)
edwardneal commentedon Feb 11, 2024
I don't know about .NET 6, but I'd be surprised if any new functionality was backported to .NET 7. MS' support lifecycle puts .NET 7 in Maintenance support, in which only security fixes are made.
The process for requesting a backport is found here. It reads to me like you'll need to wait for the current PR to be merged, then raise a second PR requesting its backport.
KevinCathcart commentedon Feb 12, 2024
I think it is unlikely for backports to be approved for this, but it also shouldn't be needed at least longer term, as if accepted it will become part of the System.IO.Packaging nuget that targets .NET Standard 2.0, so any impacted .NET 6 or .NET 7 or .NET 8 project should be able to just reference the 9.0 version of the package to add this functionality back.
Unfortunately that NuGet probably won't contain builds targeting 6 or 7, so the .NET Standard 2.0 build would get used, I'd expect that would merely impact performance rather than functionality, and the resulting performance we are talking about here should still be at .NET Framework level or better, so quite unlikely to be a showstopper.
wstaelens commentedon Feb 12, 2024
.net 6 would be great but not necessary. Backport to .net 7 would be needed.
The problem is that some clients (gov, fortune500, ..) cannot install newer (internally not approved) .net releases on some servers, and at least not .net 8 / .net 9 (some even require that a release needs to be on the market for 6months or 1 year already to be approved as "ok" or "stable") That is why I asked if this will be backported so that we could roll this out to some customers. Minor releases from an approved framework version are faster accepted.
🙄
Appreciate already what you are doing! Let's make XPS great again 👍
wstaelens commentedon Feb 22, 2024
@edwardneal would you be able to tackle this other EPIC issue with xps in .net? (dropping the STA requirement) dotnet/wpf#4000 (comment) 🤞 😃
can't wait to test the changes in production 👍
carlossanlop commentedon Jul 19, 2024
We can consider this fixed by #97898 unless someone reports otherwise.