【发布时间】:2014-04-22 14:19:58
【问题描述】:
我创建了一个 C# 安装程序应用程序。当我尝试运行桌面应用程序时,它会引发异常,并且我无法在组合框中获得任何值(尽管剩余代码运行良好)。通过 Visual Studio 2010 运行的代码运行良好。这是我单击图标时遇到的各种异常的描述。任何人都可以就我为什么得到这个提供一些帮助吗?
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: name
????? is an invalid culture identifier.
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
at System.Globalization.CultureInfo..ctor(String name)
at SampleResourceBundle.Loginpage.fillAppLangueCombo()
at SampleResourceBundle.Loginpage.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
【问题讨论】:
-
你已经在同一台机器上安装了你的应用程序,这台机器也运行 VS2010?您是否在代码中强制执行了任何特定的文化?
-
@HassanNisar 是的,我已经将应用程序安装在具有 VS2010 的同一台机器上。是的,我有用于 ResourceBundle 的 SpecificCulture.cs 文件来更改组合框中的语言。
-
应用程序加载时您强制执行哪种文化?
-
@HassanNisar static void InitResourceBundle() { ResourceBundle resBundle = ResourceBundle.GetInstance(); resBundle.LocaleRoot = "SampleResourceBundle.locale"; //我的语言环境文件是 resBundle.AddResourceFile("Form1"); resBundle.AddResourceFile("Form2"); resBundle.AddResourceFile("Form3");字符串文化 = Properties.Settings.Default.LastCulture; resBundle.Locale = 文化; Application.CurrentCulture = new CultureInfo(culture); }
-
我希望你能把上面的代码弄出来。我已经删除了Form2.resource文件。你认为这可能是异常的原因吗? @HassanNisar
标签: c# .net exception installation resourcebundle