Null Argument Exception When Printing to the Microsoft XPS Document Writer

I have a problem with printing in WPF, it happens consistently on my main development machine but I haven’t been able to reproduce it anywhere else.

And I have a solution.

If anyone else has the same problem please write a comment to this post and I’ll publish my solution, I just want to know if anyone is interested before I spend the time describing the problem and my workaround.

I get an exception of type System.ArgumentNullException

And the call stack is:

mscorlib.dll!System.Security.Permissions.FileIOPermission.HasIllegalCharacters(string[] str) + 0x94 bytes
mscorlib.dll!System.Security.Permissions.FileIOPermission.AddPathList(System.Security.Permissions.FileIOPermissionAccess access = Read | Write |PathDiscovery, System.Security.AccessControl.AccessControlActions control =None, string[] pathListOrig, bool checkForDuplicates = false, boolneedFullPath = true, bool copyPathList) + 0x5e bytes
mscorlib.dll!System.Security.Permissions.FileIOPermission.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess access, string path) +0x42 bytes
System.Printing.dll!System.Windows.Xps.XpsDocumentWriter.CreateXPSDocument(string documentName = null) + 0x4a bytes
System.Printing.dll!System.Windows.Xps.XpsDocumentWriter.BeginWrite(bool batchMode = false, bool asyncMode, bool setPrintTicketHandler = true, System.Printing.PrintTicket printTicket = null, System.Windows.Xps.Serialization.PrintTicketLevel printTicketLevel = None, bool printJobIdentifierSet) + 0x94 bytes
System.Printing.dll!System.Windows.Xps.XpsDocumentWriter.Write(System.Windows.Documents.DocumentPaginator documentPaginator = {MS.Internal.Documents.FixedDocumentPaginator}) + 0x45 bytes
PresentationFramework.dll!System.Windows.Controls.PrintDialog.PrintDocument(System.Windows.Documents.DocumentPaginator documentPaginator, string description) + 0x22 bytes 

posted @ Thursday, October 25, 2007 11:50 PM

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 4 and 3 and type the answer here: