Skip to content

XpsDocumentWriter.Write fails with NotSupportedException #1363

Closed
@thomasclaudiushuber

Description

@thomasclaudiushuber
  • .NET Core Version: 3.0.100-preview8-013410
  • Windows version: 1903
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No

Problem description:
XpsDocumentWriter.Write fails with NotSupportedException with the message "This stream from ZipArchiveEntry does not support seeking."

Actual behavior:
Message:
System.NotSupportedException : This stream from ZipArchiveEntry does not support seeking.
Stack Trace:
at WrappedStream.ThrowIfCantSeek()
at WrappedStream.SetLength(Int64 value)
at ZipWrappingStream.SetLength(Int64 value)
at ZipPackagePart.GetStreamCore(FileMode streamFileMode, FileAccess streamFileAccess)
at PackagePart.GetStream(FileMode mode, FileAccess access)
at PackagePart.GetStream(FileMode mode)
at XmlPartEditor.OpenDocumentForWrite()
at XpsPackagingPolicy.AcquireXmlWriterForFixedDocumentSequence()
at XpsSerializationManager.AcquireXmlWriter(Type writerType)
at DocumentSequenceSerializer.get_XmlWriter()
at DocumentSequenceSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
at ReachSerializer.SerializeObject(Object serializedObject)
at XpsSerializationManager.SaveAsXaml(Object serializedObject)
at XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)
at XpsDocumentWriter.Write(FixedDocumentSequence fixedDocumentSequence)

Expected behavior:
It should just create the XPS like in .NET Framework.

Minimal repro:
I've created a test project with a single test that shows the problem. The test succeeds on .NET Framework, but fails on .NET Core: https://github.com/thomasclaudiushuber/XpsNetCoreTests

Metadata

Metadata

Assignees

Labels

issue-type-tracking-externalTo track dependencies with other teams or reposrank20Rank: Priority/rank on a scale of (1..100)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions