dotnet / dotnet/wpf

.NET core WPF print dialog freeze/not supported exception

Open
#2,609 13 comments 3 reactions 1 assignee Claimed by @ryalanms View on GitHub
Bug urgent
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .NET Core Version: 3.1.101, 3.1.102
* Windows version: 1607 14393.3504
* 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:**
After select print button error appears.

**Actual behavior:**
NotSupportedException when I selected virtual printer (for example Microsoft Print to PDF). When selected in dialog real one - nothing happends, just app became unresponsible for infinity time. At debugger it stuck at WaitHandle:

![изображение](https://user-images.githubusercontent.com/10302834/74803484-14a0d480-52ee-11ea-8bbc-ff38b9d3859f.png)

```
System.NotSupportedException: Specified method is not supported.
at MS.Internal.PrintWin32Thunk.XpsPrintJobStream.Seek(Int64 offset, SeekOrigin origin)
at System.Printing.PrintQueueStream.Seek(Int64 offset, SeekOrigin origin)
at System.IO.Compression.ZipArchive.WriteFile()
at System.IO.Compression.ZipArchive.Dispose(Boolean disposing)
at System.IO.Compression.ZipArchive.Dispose()
at System.IO.Packaging.ZipPackage.Dispose(Boolean disposing)
at System.IO.Packaging.Package.System.IDisposable.Dispose()
at System.IO.Packaging.Package.Close()
at System.Windows.Xps.Packaging.XpsDocument.DisposeXpsDocument()
at System.Printing.PrintQueue.DisposeSerializationManager(Boolean abort)
at System.Windows.Xps.XpsDocumentWriter.EndWrite(Boolean disposeManager, Boolean abort)
at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)
at System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator, PrintTicket printTicket)
at System.Windows.Controls.PrintDialog.PrintDocument(DocumentPaginator documentPaginator, String description)
at WpfNetcoreTest.Program..ctor() in C:\Users\Zubastic\Source\Repos\Zubastic\PrintDialogBug\WpfNetcoreTest\Program.cs:line 18
at WpfNetcoreTest.App..ctor() in C:\Users\Zubastic\Source\Repos\Zubastic\PrintDialogBug\WpfNetcoreTest\App.xaml.cs:line 18
at WpfNetcoreTest.App.Main()
```

**Expected behavior:**
I could print PDF document at printer/save pdf file.

**Minimal repro:**
Repo for reproduce bug:
https://github.com/Zubastic/PrintDialogBug

@rladuca could u help me with that issue? 1607 is important for me, because enterprise use LTSB version. At 1809 and newer version all is good.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.