Results 1 to 5 of 5

Thread: PrintDocument crash

  1. #1

    Thread Starter
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    PrintDocument crash

    I'm using a DocumentPaginator to print using the PrintDialog.PrintDocument method, eg.

    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);
    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.

    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!)
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  2. #2
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    Re: PrintDocument crash

    Can you get a hold of a crash dump or an error message? There may be an error message logged in the event viewer in mmc.
    My monkey wearing the fedora points and laughs at you.

  3. #3

    Thread Starter
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: PrintDocument crash

    The event viewer is a good idea. Unfortunately it's non-trivial to get these users to do much of anything. Having them look through the event viewer to find anything fishy would probably take a long time over the phone, and at this point I believe everyone affected has found a workaround one way or another. It'd be very convenient if I could just reproduce the issue myself on my own XP machine, or if I could get my hands on one that's erroring.

    One user updated his printer driver and the issue was resolved. I had suggested this as a possible fix, along with using a different printer and updating the OS. To be honest I'm surprised this user was able to update their driver by themselves--I suspect they had been ignoring auto update notifications and finally stopped ignoring them. Regardless, this reinforces my hunch about the issue being driver-WPF-XP-specific, and not directly my problem.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  4. #4
    New Member
    Join Date
    Aug 2012
    Posts
    1

    Re: PrintDocument crash

    Quote Originally Posted by jemidiah View Post
    whenever they try to print, the program crashes.
    ...
    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.
    Hi there, it's an old thread but I stumbled on exact same issue trying to print with WPF PrintDialog in C# and found this via google.
    In my case, while .Net 1.1 and .Net 4 were installed, .Net 3.5 (including 2.0 and 3.0) was missing.
    Installing it fixed the problem.

    greetings

  5. #5

    Thread Starter
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: PrintDocument crash

    Interesting. Thanks for taking the time to voice your experience. In my own case (as I recall) the users in question upgraded their machines. I feel a little bad about that, but to be fair they were running a 10-year-old OS on old hardware and partly wanted excuses to upgrade anyway, so everything worked out well enough. Thanks again. Hopefully it'll help someone else.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width