I'm using a DocumentPaginator to print using the PrintDialog.PrintDocument method, eg.
This works just fine the vast majority of the time. Two of my users are having trouble, though. For one of them, whenever they try to print, the program crashes. For another, whenever they try to print to a particular printer (actually the Windows fax printer), the program crashes. Both are running XP SP3. Several other users are also running XP SP3 and I have a testing machine running it and none of us have had an issue. Numerous users on Vista or 7 have not had any issues whatsoever.Code:// pd is a PrintDialog the user has picked a printer for // dp is a (subclass of a) DocumentPaginator // Description is a string pd.PrintDocument(dp, Description);
The interesting bit is that I've wrapped the PrintDocument call in a try...catch(Exception e) block, yet the program still crashes. I put in a message box just before the PrintDocument call and had both users test it. Both got the message box, and immediately afterward the program crashed. The message box inside the catch block never fired.
At this point I'm at a loss. I can't reproduce the error myself and I can't catch it, which seems to indicate an OS-specific bug in the WPF printing system's interactions with certain printer drivers. Because WPF is so seemingly ill-adopted and running .NET 4 apps on XP isn't that common, I imagine the number of users who might uncover such a bug is quite small, so I can imagine it slipping under the radar. I've done a fair amount of searching and haven't found a single useful lead. (In fact, my own post on WPF printing is the only thing that came up in the most relevant searches on these forums.)
Without any other ideas I've recommended both users upgrade their OS's, but I wanted to ask here in case somebody else had any ideas or experience with this issue. (To be completely honest I expect this thread to go unanswered, but if not that'd be awesome!)