1. <i id='PVRnK'><tr id='PVRnK'><dt id='PVRnK'><q id='PVRnK'><span id='PVRnK'><b id='PVRnK'><form id='PVRnK'><ins id='PVRnK'></ins><ul id='PVRnK'></ul><sub id='PVRnK'></sub></form><legend id='PVRnK'></legend><bdo id='PVRnK'><pre id='PVRnK'><center id='PVRnK'></center></pre></bdo></b><th id='PVRnK'></th></span></q></dt></tr></i><div id='PVRnK'><tfoot id='PVRnK'></tfoot><dl id='PVRnK'><fieldset id='PVRnK'></fieldset></dl></div>
    <legend id='PVRnK'><style id='PVRnK'><dir id='PVRnK'><q id='PVRnK'></q></dir></style></legend>
      <bdo id='PVRnK'></bdo><ul id='PVRnK'></ul>

    <small id='PVRnK'></small><noframes id='PVRnK'>

  2. <tfoot id='PVRnK'></tfoot>

      在 .NET 框架中强制使用英语语言异常

      时间:2023-08-26
      <tfoot id='At0Mf'></tfoot>
      • <bdo id='At0Mf'></bdo><ul id='At0Mf'></ul>

        1. <small id='At0Mf'></small><noframes id='At0Mf'>

          <legend id='At0Mf'><style id='At0Mf'><dir id='At0Mf'><q id='At0Mf'></q></dir></style></legend>
          <i id='At0Mf'><tr id='At0Mf'><dt id='At0Mf'><q id='At0Mf'><span id='At0Mf'><b id='At0Mf'><form id='At0Mf'><ins id='At0Mf'></ins><ul id='At0Mf'></ul><sub id='At0Mf'></sub></form><legend id='At0Mf'></legend><bdo id='At0Mf'><pre id='At0Mf'><center id='At0Mf'></center></pre></bdo></b><th id='At0Mf'></th></span></q></dt></tr></i><div id='At0Mf'><tfoot id='At0Mf'></tfoot><dl id='At0Mf'><fieldset id='At0Mf'></fieldset></dl></div>

                <tbody id='At0Mf'></tbody>

                本文介绍了在 .NET 框架中强制使用英语语言异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                在使用 ASP.NET MVC 时,我注意到安装在我的系统上的 .NET 框架发出的异常消息是德语的.我真的更喜欢英文信息,所以我可以在 SO 上发布它们.

                While working with ASP.NET MVC, I have noticed that exception messages issued by the .NET framework installed on my System are in German. I'd really prefer English messages, so I can post them on SO.

                我知道之前有人问过这个问题,但奇怪的是,在我的情况下,建议的解决方法似乎都不起作用.我已经尝试了以下方法:

                I know this has been asked before on SO, but strangely enough none of the suggested workarounds seem to work in my case. I have already tried the following:

                • 将我的 Windows 系统切换到英语语言环境并重新启动 Visual Studio
                • 设置工具 -> 选项 -> 环境 -> 国际设置 -> 语言为英语"
                • 在抛出异常之前将线程区域设置为英语,如下所示:

                • switching my Windows system to an English locale and restarting Visual Studio
                • Setting Tools -> Options -> Environment -> International Settings -> Language to "English"
                • setting the thread locale to English right before the exception is thrown as follows:

                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture ("zh-CN");Thread.CurrentThread.CurrentUICulture=new CultureInfo("en-US");

                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture ("en-US"); Thread.CurrentThread.CurrentUICulture=new CultureInfo("en-US");

                //调用我的错误方法...

                //call my faulty method...

                那么,如何使 .NET 框架发出英语异常消息?是否有任何方法可以在每个解决方案甚至整个系统范围内执行此操作?

                So, how can I make the .NET framework issue English language exception messages? And is there any approach that does this on a per-solution or even system-wide basis?

                在执行我的单元测试时抛出异常.我不确定这是否是设置线程文化无效的原因.

                The exception is thrown while excuting my unit tests. I am not sure if this is the reason setting the thread's culture had not effect.

                推荐答案

                我刚刚发现,问题确实与测试项目不同.虽然我在实际项目中尝试将 UI 语言设置为英语,但我在测试项目中没有这样做,这就是为什么在查看测试结果时异常消息仍然是德语的原因.

                As I just found out, the problem was indeed related to having a different test project. While I have tried setting the UI language to English in my actual project, I did not do the same in the test project, which is why the exception messages were still in German when looking at the test results.

                在抛出异常之前在测试方法中设置 UI 语言对我来说是诀窍.

                Setting the UI language in the test method right before the exception is thrown did the trick for me.

                这篇关于在 .NET 框架中强制使用英语语言异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:用户消息中的多个 下一篇:带有自定义 ResourceProvider 的 DataAnnotation

                相关文章

                最新文章

                  <bdo id='Dqrjy'></bdo><ul id='Dqrjy'></ul>
                <tfoot id='Dqrjy'></tfoot>

              • <small id='Dqrjy'></small><noframes id='Dqrjy'>

                  <i id='Dqrjy'><tr id='Dqrjy'><dt id='Dqrjy'><q id='Dqrjy'><span id='Dqrjy'><b id='Dqrjy'><form id='Dqrjy'><ins id='Dqrjy'></ins><ul id='Dqrjy'></ul><sub id='Dqrjy'></sub></form><legend id='Dqrjy'></legend><bdo id='Dqrjy'><pre id='Dqrjy'><center id='Dqrjy'></center></pre></bdo></b><th id='Dqrjy'></th></span></q></dt></tr></i><div id='Dqrjy'><tfoot id='Dqrjy'></tfoot><dl id='Dqrjy'><fieldset id='Dqrjy'></fieldset></dl></div>
                  <legend id='Dqrjy'><style id='Dqrjy'><dir id='Dqrjy'><q id='Dqrjy'></q></dir></style></legend>