Article ID: 945538 - Last Review: December 7, 2007 - Revision: 1.0

Error message when you try to print an .xps document in Windows Vista or in Windows XP: "An error occurred in the application you were using"

System TipThis article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

On This Page

Expand all | Collapse all

SYMPTOMS

Consider the following scenario. You try to print an .xps document in Windows Vista or in Windows XP by using the Microsoft XPS Document Writer. Or, you try to print to a Microsoft XPS Document Writer (MXDW) printer. In this scenario, you receive the following error message in the Web browser while the printer is spooling:
An error occurred in the application you were using

You can try the following:

Restart the application
Click the "More Information" button below for details about this error.

RESOLUTION

To resolve this problem, refer the owner of the document to this Microsoft Knowledge Base article (945538), if this is possible.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Advanced troubleshooting for document creator

CAUSE

This problem occurs if the following conditions are true:
  • The DocumentPaginator class is serialized asynchronously.
  • The DocumentPaginator class has a ColorContext file (.icc) file that must be serialized.

WORKAROUND

To work around this problem, use a different color profile when you create the .xps document.

MORE INFORMATION

If you click More Information after you receive the error message that is mentioned in the "Symptoms" section, you receive the following message:
Startup URI: E:\USLetter\fts_individual\fts_4106.xps
Application Identity: 

System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Xps.Serialization.ColorTypeConverter.SerializeColorContext(IServiceProvider context, ColorContext colorContext)
   at System.Windows.Xps.Serialization.ColorTypeConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType)
   at System.Windows.Xps.Serialization.VisualSerializer.ColorToString(Color color)
   at System.Windows.Xps.Serialization.VisualSerializer.SimpleBrushToString(Brush brush)
   at System.Windows.Xps.Serialization.VisualSerializer.WriteBrush(String attribute, Brush brush, Rect bounds)
   at System.Windows.Xps.Serialization.VisualSerializer.System.Windows.Xps.Serialization.IMetroDrawingContext.DrawGlyphRun(Brush foreground, GlyphRun glyphRun)
   at System.Windows.Xps.Serialization.DrawingContextFlattener.DrawGlyphRun(Brush foreground, GlyphRun glyphRun)
   at System.Windows.Xps.Serialization.VisualTreeFlattener.DrawingWalk(Drawing d, Matrix drawingToWorldTransform)
   at System.Windows.Xps.Serialization.VisualTreeFlattener.DrawingWalk(Drawing d, Matrix drawingToWorldTransform)
   at System.Windows.Xps.Serialization.VisualTreeFlattener.DrawingWalk(Drawing d, Matrix drawingToWorldTransform)
   at System.Windows.Xps.Serialization.VisualTreeFlattener.StartVisual(Visual visual)
   at System.Windows.Xps.Serialization.ReachVisualSerializerAsync.SerializeNextTreeNode(ReachVisualSerializerContext context)
   at System.Windows.Xps.Serialization.ReachVisualSerializerAsync.AsyncOperation(ReachSerializerContext context)
   at System.Windows.Xps.Serialization.XpsSerializationManagerAsync.InvokeSaveAsXamlWorkItem(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.StartDispatcherInBrowser(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)


-----------------------

XPSViewer.exe v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\SysWOW64\XPSViewer\XPSViewer.exe
ntdll.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\SysWOW64\ntdll.dll
kernel32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\kernel32.dll
ADVAPI32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\ADVAPI32.dll
RPCRT4.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\RPCRT4.dll
Secur32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\Secur32.dll
USER32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\USER32.dll
GDI32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\GDI32.dll
msvcrt.dll v7.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\msvcrt.dll
ole32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\ole32.dll
OLEAUT32.dll v6.0.6000.16386 - C:\Windows\syswow64\OLEAUT32.dll
SHELL32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\SHELL32.dll
SHLWAPI.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\SHLWAPI.dll
urlmon.dll v7.00.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\urlmon.dll
iertutil.dll v7.00.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\iertutil.dll
IMM32.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\IMM32.DLL
MSCTF.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\MSCTF.dll
LPK.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\LPK.DLL
USP10.dll v1.0626.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\USP10.dll
comctl32.dll v6.10 (vista_rtm.061101-2205) - C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6000.16386_none_5d07289e07e1d100\comctl32.dll
uxtheme.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\uxtheme.dll
CLBCatQ.DLL v2001.12.6930.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\CLBCatQ.DLL
rsaenh.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\rsaenh.dll
PresentationHostDLL.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\Microsoft.Net\Framework\v3.0\WPF\PresentationHostDLL.dll
mscoree.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\system32\mscoree.dll
VERSION.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\VERSION.dll
mscorwks.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
MSVCR80.dll v8.00.50727.312 - C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.312_none_10b2ee7b9bffc2c7\MSVCR80.dll
mscorlib.ni.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\assembly\NativeImages_v2.0.50727_32\mscorlib\7fe79782947b85d961fd55cb5e02a129\mscorlib.ni.dll
System.ni.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\assembly\NativeImages_v2.0.50727_32\System\fcc712bc5da45a672e7f1ad176dbd5a5\System.ni.dll
WindowsBase.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\WindowsBase\3b53dcf335a24dff03c7354dfebcb049\WindowsBase.ni.dll
PresentationCore.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\PresentationCore\05a907016da277d7fbfbb00d347e3d3c\PresentationCore.ni.dll
PresentationFramework.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\PresentationFramewo#\42c74db0a1a5378aab3f28b459240c17\PresentationFramework.ni.dll
actxprxy.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\SysWOW64\actxprxy.dll
SXS.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\SXS.DLL
PresentationUI.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\PresentationUI\54041410d2178e8324aaaab000e17289\PresentationUI.ni.dll
System.Xml.ni.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Xml\f76a7622c73e26e4d2daf54068d7ff79\System.Xml.ni.dll
ReachFramework.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\ReachFramework\f5bcb483a670b5e9255baeac58af965f\ReachFramework.ni.dll
PresentationFramework.Aero.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\PresentationFramewo#\96a636ef98d604b3ed8cf8fa80bf41a2\PresentationFramework.Aero.ni.dll
MilCore.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\MilCore.dll
PSAPI.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\PSAPI.DLL
DWMAPI.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\DWMAPI.dll
d3d9.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\d3d9.dll
d3d8thk.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\d3d8thk.dll
atiumdag.dll v7.14.10.0443 - C:\Windows\system32\atiumdag.dll
atiumdva.dll v7.14.10.0121 - C:\Windows\system32\atiumdva.dll
mscms.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\mscms.dll
WINSPOOL.DRV v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\WINSPOOL.DRV
USERENV.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\USERENV.dll
WindowsCodecs.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\WindowsCodecs.dll
System.Configuration.ni.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Configuration\d7b63c1d2ab17ac3cc24881c4ff78b63\System.Configuration.ni.dll
icm32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\icm32.dll
PresentationCFFRasterizer.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\PresentationCFFRast#\9a44b47a9bd2e136660fc2170dd43ad6\PresentationCFFRasterizer.ni.dll
PresentationCFFRasterizerNative_v0300.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\system32\PresentationCFFRasterizerNative_v0300.dll
PresentationNative_v0300.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\system32\PresentationNative_v0300.dll
WINMM.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\WINMM.dll
OLEACC.dll v4.2.5406.0 (vista_rtm.061101-2205) - C:\Windows\system32\OLEACC.dll
msctfui.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\msctfui.dll
msdrm.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\msdrm.dll
ATL.DLL v3.05.2284 - C:\Windows\system32\ATL.DLL
SHFOLDER.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\SHFOLDER.dll
System.Printing.ni.dll v3.0.6913.0 (vista_rtm_wcp.061013-1925) - C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Printing\7dd9e1c0d62926a97d11de0bf2475996\System.Printing.ni.dll
System.Drawing.ni.dll v2.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Drawing\70c145ed25af403aa899ffcb633350b1\System.Drawing.ni.dll
comdlg32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\comdlg32.dll
BROWSEUI.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\BROWSEUI.dll
PROPSYS.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\PROPSYS.dll
DUser.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\DUser.dll
thumbcache.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\SysWOW64\thumbcache.dll
SHDOCVW.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\SHDOCVW.dll
ieframe.dll v7.00.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\ieframe.dll
apphelp.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\apphelp.dll
PRINTUI.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\PRINTUI.dll
ACTIVEDS.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\ACTIVEDS.dll
adsldpc.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\adsldpc.dll
NETAPI32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\NETAPI32.dll
WLDAP32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\WLDAP32.dll
WS2_32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\WS2_32.dll
NSI.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\NSI.dll
credui.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\credui.dll
CFGMGR32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\CFGMGR32.dll
setupapi.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\syswow64\setupapi.DLL
MPR.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\MPR.dll
puiapi.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\puiapi.dll
WTSAPI32.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\WTSAPI32.dll
slc.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\slc.dll
IPHLPAPI.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\IPHLPAPI.DLL
dhcpcsvc.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\dhcpcsvc.DLL
DNSAPI.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\DNSAPI.dll
WINNSI.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\WINNSI.DLL
dhcpcsvc6.DLL v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\dhcpcsvc6.DLL
prntvpt.dll v6.0.6000.16386 (vista_rtm.061101-2205) - C:\Windows\system32\prntvpt.dll
diasymreader.dll v8.0.50727.312 (rtmLHS.050727-3100) - C:\Windows\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll

APPLIES TO
  • Windows Vista Enterprise 64-bit Edition
  • Windows Vista Home Basic 64-bit Edition
  • Windows Vista Home Premium 64-bit Edition
  • Windows Vista Ultimate 64-bit Edition
  • Windows Vista Business
  • Windows Vista Business 64-bit Edition
  • Windows Vista Enterprise
  • Windows Vista Home Basic
  • Windows Vista Home Premium
  • Windows Vista Ultimate
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
Keywords: 
kberrmsg kbtshoot kbprb KB945538