Repository navigation
Closed
Labels
Description
Description
When using DocumentViewer control, repeated search for any text throws an IOException.
Message -
System.IO.IOException: 'Entries cannot be opened multiple times in Update mode
Stack Trace -
at System.IO.Compression.ZipArchiveEntry.OpenInUpdateMode()
at System.IO.Compression.ZipArchiveEntry.Open()
at System.IO.Packaging.ZipStreamManager.Open(ZipArchiveEntry zipArchiveEntry, FileMode streamFileMode, FileAccess streamFileAccess)
at System.IO.Packaging.ZipPackagePart.GetStreamCore(FileMode streamFileMode, FileAccess streamFileAccess)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at MS.Internal.IO.Packaging.PackagePartExtensions.GetSeekableStream(PackagePart packPart, FileMode mode, FileAccess access)
at System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.GetResponseStream()
at MS.Internal.WpfWebRequestHelper.CreateRequestAndGetResponseStream(Uri uri)
at System.Windows.Documents.PageContent.GetPageStream()
at System.Windows.Documents.FixedFindEngine._GetPageString(FixedDocument doc, Int32 translatedPageNo, Boolean replaceAlefWithAlefHamza)
at System.Windows.Documents.FixedFindEngine.Find(ITextPointer start, ITextPointer end, String findPattern, CultureInfo cultureInfo, Boolean matchCase, Boolean matchWholeWord, Boolean matchLast, Boolean matchDiacritics, Boolean matchKashida, Boolean matchAlefHamza)
at System.Windows.Documents.TextFindEngine.Find(ITextPointer findContainerStartPosition, ITextPointer findContainerEndPosition, String findPattern, FindFlags flags, CultureInfo cultureInfo)
at MS.Internal.Documents.DocumentViewerHelper.Find(FindToolBar findToolBar, TextEditor textEditor, ITextView textView, ITextView masterPageTextView)
at System.Windows.Controls.Primitives.DocumentViewerBase.Find(FindToolBar findToolBar)
at System.Windows.Controls.DocumentViewer.OnFindInvoked(Object sender, EventArgs e)
at MS.Internal.Documents.FindToolBar.OnFindTextBoxPreviewKeyDown(Object sender, KeyEventArgs e)
at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
at System.Windows.Interop.ThreadMessageEventHandler.Invoke(MSG& msg, Boolean& handled)
at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at DocumentViewerException.App.Main()
Reproduction Steps
- Use a machine with Visual Studio 2022
- Unzip the attached sample DocumentViewerExceptionRepro.zip
- Build and run the application
- At the bottom of the main window there is a search control
- search for any string and press the same search button multiple times
Expected behavior
Should not throw exception
Actual behavior
Throws exception
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
.NET Core 6, 7
Activity