Q:

Report viewer hangs silently after closing with the X

Update it seems like the app doesn't know when the print task has finished, and keeps the connection open indefinitely. is there a way to kill this connection?
when i debug a wpf with a report viewer and i print a document, i can't seem to fully close the wpf.
i press the X on the window and the window closes, but vs keeps running. Pausing doesn't show where it stays hanging though and there aren't any threads in the wpf.
we overwrote the printing to skip the dialog, but trying to set everything to null after it runs doesn't help. Any ideas why it keeps hanging? (closing the app before it prints works fine.)
These three threads are still working, is there a way to find out why they stay open?
Unflagged       1424    7   Worker Thread   vshost.RunParkingWindow [Managed to Native Transition]  Normal
Unflagged       4320    8   Worker Thread   .NET SystemEvents   [Managed to Native Transition]  Normal
Unflagged   >   4332    9   Main Thread Main Thread [Managed to Native Transition]  Normal
        protected override void OnPrintCommand()
    {
        PrintDialog printDialog = new PrintDialog();
        printDialog.PrintQueue = LocalPrintServer.GetDefaultPrintQueue();
        printDialog.PrintTicket = printDialog.PrintQueue.DefaultPrintTicket;

        FixedDocument fixedDocument = this.Document as FixedDocument;               
        FixedDocumentSequence fixedDocumentSequence = this.Document as FixedDocumentSequence;               
        if (fixedDocument != null) fixedDocument.PrintTicket = printDialog.PrintTicket;               
        if (fixedDocumentSequence!= null) fixedDocumentSequence.PrintTicket = printDialog.PrintTicket;               

        XpsDocumentWriter writer = PrintQueue.CreateXpsDocumentWriter(printDialog.PrintQueue);              
        if (fixedDocument != null) writer.WriteAsync(fixedDocument, printDialog.PrintTicket);               
        if (fixedDocumentSequence != null) writer.WriteAsync(fixedDocumentSequence, printDialog.PrintTicket);

        printDialog = null;
        fixedDocument = null;
        fixedDocumentSequence = null;
        writer = null;
    }

A:

Although the extension suppressed the document viewer from popping up, the report stayed active in the background.
the solution was simple, not to suppress the viewer, print the document and then close the viewer. Optionally you could also hide the viewer before closing it.
The app closes itself after this fix.

