【发布时间】:2010-09-08 16:12:55
【问题描述】:
我有一个简单的 WPF 应用程序,我正在尝试启动它。我正在遵循 Microsoft 模式和实践“WPF 的复合应用程序指南”。我已按照他们的说明进行操作,但是我的 WPF 应用程序立即失败并出现“TypeInitializationException”。
InnerException 属性显示“'System.Windows.Navigation.BaseUriHelper' 的类型初始化程序引发了异常。”
这是我的 app.xaml:
<Application x:Class="MyNamespace.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
</Application.Resources>
</Application>
这是我的 app.xaml.cs(在“public App()”处抛出异常):
public partial class App : Application
{
public App()
{
Bootstrapper bootStrapper = new Bootstrapper();
bootStrapper.Run();
}
}
我已将“App”类设置为项目中的启动对象。
怎么回事?
【问题讨论】: