System.Deployment.Application.InvalidDeploymentException

找到一篇讲得比较好的文章,分享一下。
.net – What causes an InvalidDeploymentException in a WPF application
翻译一下Best Solution吧:(如果不想看,直接看红色字体

This is a “first chance exception”, which means the debugger is simply notifying you that an exception was thrown, rather than that one was unhandled.

这是一个“First Chance Exception”,就是说调试器只是通知你有异常被抛出了,而不是没被处理。

The .NET Framework is throwing and catching that exception internally—the debugger tells you that it occurs in some code in System.Deployment.dll.

.Net Framework在内部抛出并处理这个异常——调试器告诉你它出现在System.Deployment.dll中的某段代码中。

The exception is raised when an attempt is made to access user/network information, but the underlying code is catching the exception when it occurs and automatically resuming execution. There’s nothing you can do about it, and it’s relatively harmless.

这个异常是在尝试访问用户/网络信息时被抛出的,但是底层代码在该异常出现时捕捉到它,并自动恢复了程序执行。对此你做不了什么,而且它相对来说也没有害处。

You are most likely attempting to retrieve the AppData path for the current user, in which case the Framework needs to determine if your application is a normal app or a ClickOnce app in order to return the correct path. If you are a ClickOnce app, the correct data is simply returned. Otherwise, an exception is thrown, which is caught by the Framework and the assumption is made that your application is not a ClickOnce app, causing the standard user path to be returned instead.

你(的程序)很可能在尝试检索当前用户的APPData路径,这个时候.Net Framework需要通过判断你的程序是正常APP还是ClickOnce APP来返回正确的路径。如果是ClickOnce APP,就返回正确路径;否则,就会抛出异常,被.Net Framework捕捉,程序就会被认为不是ClickOnce APP,返回的就是标准用户路径。

There are a number of exceptions that are thrown and handled while an application is running. There’s no harm unless they’re unhandled. If this really bugs you, you can customize the exceptions about which the debugger informs you. For example:

  1. Open the Exceptions window from the Debug menu.
  2. Expand “Common Language Runtime Exceptions”-> “System.Deployment.Application”.
  3. Uncheck the box next to “System.Deployment.Application.InvalidDeploymentException”.

程序运行过程中会有许多异常被抛出和处理。除非没有被(正确)处理,否则都是无害的。如果这(InvalidDeploymentException)真的很困扰你,你可以更改调试器的异常设置,比如:

  1. 菜单:调试->窗口->异常窗口;
  2. 搜索异常名字;
  3. Uncheck不想收到通知的异常
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值