System.Printing.PrintServer Win32Exception当该文件已存在时,无法创建文件

时间:2017-04-13 13:51:13

标签: c# .net

当我尝试在我的代码中创建一个新变量时,偶尔会出现一个意外的异常,而我完全不知道是什么原因可能会导致问题。

将非常感激地收到任何指导或建议

谢谢!

代码......

using System.Printing;

var ps = new PrintServer();

例外......

System.ComponentModel.Win32Exception (0x80004005): Cannot create a file when that file already exists
    at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)
    at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
    at System.Windows.Threading.Dispatcher..ctor()
    at System.Windows.Threading.Dispatcher.get_CurrentDispatcher()
    at System.Printing.PrintServer.Initialize(String path, String[] propertiesFilter, PrinterDefaults printerDefaults)
    at System.Printing.PrintServer..ctor()

命名空间System.Printing info ...

#region Assembly System.Printing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Printing.dll
#endregion

0 个答案:

没有答案