简体   繁体   English

设置,设置和<legacyUnhandledExceptionPolicy enabled=“1”/>

[英]Settings.settings and <legacyUnhandledExceptionPolicy enabled=“1”/>

I have a C#/.NET Winforms application which has some settings stored using A '.settings' file. 我有一个C#/。NET Winforms应用程序,该应用程序使用A'.settings'文件存储了一些设置。 So the configuration is edited by right-clicking the project in "Solution Explorer" and selecting "Properties->Settings". 因此,通过右键单击“ Solution Explorer”中的项目并选择“ Properties-> Settings”来编辑配置。

However, I also need to be able to catch exceptions thrown by a SerialPort object inside the application. 但是,我还需要能够捕获应用程序内部SerialPort对象引发的异常。 I found a snippet on the web stating that adding 我在网上发现了一个片段,说明该添加

<runtime>
  <legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>

... in the app.config file would fix this (which it did). ...在app.config文件中将解决此问题(确实如此)。 BUT: Now a have both a "Settings.settings" and an "app.config" file in my Solution Explorer, which causes some developers to edit eg "app.config" and not "Settings.settings" causing much confusion. 但是:现在,我的解决方案资源管理器中同时有一个“ Settings.settings”和一个“ app.config”文件,这使一些开发人员进行编辑,例如“ app.config”而不是“ Settings.settings”,这引起了很大的混乱。 Is it possible to make the "Settings" class generate the 'legacyUnhandledExceptionPolicy'-thingy the app.config file automatically? 是否可以使“ Settings”类自动生成“ legacyUnhandledExceptionPolicy” -thing app.config文件? Or what else should I do? 还是我该怎么办? Any suggestions? 有什么建议么?

我将简单地得出结论,这无法完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM