Skip to content

IOException in ZipArchiveEntry.OpenInUpdateMode when printing #6842

@bgrainger

Description

@bgrainger
  • .NET Core Version: Microsoft.NETCore.App 6.0.7
  • Windows version: Windows 10 21H2 x64, 19044.1826
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No

Problem description:

In a WPF application ported to .NET 6.0 from .NET Framework 4.7.2, printing a complex document throws an exception, and nothing prints. (The Microsoft Print to PDF driver writes a 0-byte file.)

At the moment, I don't have a self-contained repro, but reporting the call stack as part of starting the investigation, and in case anyone else has relevant information.

Actual behavior:

System.IO.IOException: 'Entries cannot be opened multiple times in Update mode.'

System.IO.Compression.dll!System.IO.Compression.ZipArchiveEntry.OpenInUpdateMode() Line 699	C#
System.IO.Compression.dll!System.IO.Compression.ZipArchiveEntry.Open() Line 297	C#
System.IO.Packaging.dll!System.IO.Packaging.ZipStreamManager.Open(System.IO.Compression.ZipArchiveEntry zipArchiveEntry, System.IO.FileMode streamFileMode, System.IO.FileAccess streamFileAccess) Line 85	C#
System.IO.Packaging.dll!System.IO.Packaging.ZipPackagePart.GetStreamCore(System.IO.FileMode streamFileMode, System.IO.FileAccess streamFileAccess) Line 45	C#
System.IO.Packaging.dll!System.IO.Packaging.PackagePart.GetStream(System.IO.FileMode mode, System.IO.FileAccess access) Line 320	C#
WindowsBase.dll!MS.Internal.IO.Packaging.PackagePartExtensions.GetSeekableStream(System.IO.Packaging.PackagePart packPart, System.IO.FileMode mode, System.IO.FileAccess access) Line 62	C#
PresentationCore.dll!System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream() Line 652	C#
PresentationCore.dll!System.IO.Packaging.PackWebResponse.GetResponseStream() Line 273	C#
PresentationCore.dll!MS.Internal.WpfWebRequestHelper.CreateRequestAndGetResponseStream(System.Uri uri) Line 180	C#
ReachFramework.dll!System.Windows.Xps.Serialization.ImageSourceTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) Line 245	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualSerializer.WriteBitmap(string attribute, System.Windows.Media.ImageSource imageSource) Line 647	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualSerializer.BrushToString(System.Windows.Media.Brush brush, System.Windows.Rect bounds) Line 774	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualSerializer.FindBrush(System.Windows.Media.Brush brush, System.Windows.Rect bounds) Line 273	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualSerializer.WriteBrush(string attribute, System.Windows.Media.Brush brush, System.Windows.Rect bounds) Line 905	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualSerializer.System.Windows.Xps.Serialization.IMetroDrawingContext.DrawGeometry(System.Windows.Media.Brush brush, System.Windows.Media.Pen pen, System.Windows.Media.Geometry geometry) Line 1925	C#
ReachFramework.dll!System.Windows.Xps.Serialization.DrawingContextFlattener.DrawGeometry(System.Windows.Media.Brush brush, System.Windows.Media.Pen pen, System.Windows.Media.Geometry geometry) Line 283	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualTreeFlattener.DrawingWalk(System.Windows.Media.Drawing d, System.Windows.Media.Matrix drawingToWorldTransform) Line 699	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualTreeFlattener.DrawingWalk(System.Windows.Media.Drawing d, System.Windows.Media.Matrix drawingToWorldTransform) Line 761	C#
ReachFramework.dll!System.Windows.Xps.Serialization.VisualTreeFlattener.StartVisual(System.Windows.Media.Visual visual) Line 641	C#
ReachFramework.dll!System.Windows.Xps.Serialization.ReachVisualSerializerAsync.SerializeNextTreeNode(System.Windows.Xps.Serialization.ReachVisualSerializerContext context) Line 174	C#
ReachFramework.dll!System.Windows.Xps.Serialization.ReachVisualSerializerAsync.AsyncOperation(System.Windows.Xps.Serialization.ReachSerializerContext context) Line 73	C#
ReachFramework.dll!System.Windows.Xps.Serialization.XpsOMSerializationManagerAsync.InvokeSaveAsXamlWorkItem(object arg) Line 148	C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 103	C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Line 36	C#
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Line 540	C#
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) Line 489	C#
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) Line 215	C#
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 183	C#
System.Private.CoreLib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 148	C#
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 172	C#
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Line 412	C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Line 2087	C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 2296	C#
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 295	C#
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Line 429	C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 103	C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Line 36	C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1329	C#
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 341	C#
[Native to Managed Transition]	
[Managed to Native Transition]	
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Line 2135	C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) Line 329	C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() Line 297	C#
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Line 2405	C#
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Line 1695	C#
PresentationFramework.dll!System.Windows.Application.Run() Line 198	C#

Expected behavior:

Printing works without exception.

Minimal repro:

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more informationNot enough information has been provided. Please share more detail as requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions