Settings.settings and <legacyUnhandledExceptionPolicy enabled="1"/>
I have a C#/.NET Winforms application which has some settings stored using A '.settings' file. So the configuration is edited by right-clicking the project in "Sol开发者_JAVA百科ution Explorer" and selecting "Properties->Settings".
However, I also need to be able to catch exceptions thrown by a SerialPort object inside the application. 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). BUT: Now a have both a "Settings.settings" and an "app.config" file in my Solution Explorer, which causes some developers to edit e.g. "app.config" and not "Settings.settings" causing much confusion. Is it possible to make the "Settings" class generate the 'legacyUnhandledExceptionPolicy'-thingy the app.config file automatically? Or what else should I do? Any suggestions?
I'll simply conclude that This can't be done.
精彩评论