Tag: xamlparseexception

WPF – XamlParseException在Window类中的unit testing方法时

我正在尝试使用MSTest为我的WPF应用程序中的MainWindow类中的方法编写unit testing。 但是,我得到以下exception: System.Windows.Markup.XamlParseException:’在’System.Windows.StaticResourceExtension’上提供值引发exception。 行号“127”和行位置“32”。 —> System.Exception:找不到名为’verticalLineStyle’的资源。 资源名称区分大小写。 verticalLineStyle位于App.xaml包含的ResourceDictionary中。 我不需要这种风格来测试我试图测试的方法,但我无法超越这个。 我只是在我的unit testing中创建一个MainWindow的新实例,并尝试在其上调用实例方法。 当我尝试创建MainWindow实例时发生exception。 MainWindow被定义为public partial class MainWindow : Window 。 我该如何摆脱这个错误? 在WPF应用程序的窗口中是否有一些首选的unit testing方法?

View中的XamlParseException

我有一个只显示标签的视图。 视图模型在视图中正确注入,因为标签的文本绑定到viewmodel属性。 现在,如果我尝试在xaml中定义DataGrid,我有一个XamlParseException: {System.Windows.Markup.XamlParseException:未找到类型’DataGrid’。 [行:16位置:45] su System.Windows.Application.LoadComponent(Object component,Uri resourceLocator)su Common.Views.FunctionalityView.InitializeComponent()su Common.Views.FunctionalityView..ctor(IFunctionalityViewModel viewModel)} 但是如果我在InitializeComponent();之前定义一个DataGrid myDg = new DataGrid() InitializeComponent(); 有用。 我检查了所有参考文献,仍然无法找到问题。

窗口启动时出现xamlParseException

当我从应用程序中的另一个窗口显示此窗口时,出现以下错误: XamlParseException发生’Set connectionId引发exception。’ 行号“4”和行位置“25”。 内部例外: {“无法将’System.Windows.Controls.TabControl’类型的对象强制转换为’WpfApplication1.Window1’。”} 我的xaml代码如下: 如果您需要我的C#代码来解决这个问题,我可以通过电子邮件发送给您,但是将该代码放在网上是违反公司政策的( 我喜欢我的工作……我不想被解雇) 请记住,我在VB.net中正常开发,而C#.net对我来说是一个新手,所以如果你能详细说明你的初学者的解释,将不胜感激。 c#.net vs2010 Windows Vista x64 Intel Core 2 Quad

如何从用户的计算机获取有用的WPF .NET错误信息?

我有一个WPF应用程序崩溃了一旦我把它安装到没有安装开发环境的机器上 – 如果这是一个骗局,我欢迎关闭,但我的搜索function未能找到一个相同的问题。 看来我得到了一个XamlParseException,但没有比这更有用了。 我需要获得有用的信息。 浏览Windows 7事件日志会给我这个错误日志: Fault bucket , type 0 Event Name: CLR20r3 Response: Not available Cab Id: 0 Problem signature: P1: MyApp.exe P2: 1.0.0.0 P3: 4b88323d P4: PresentationFramework P5: 3.0.0.0 P6: 4a174fbc P7: 624f P8: e1 P9: System.Windows.Markup.XamlParse P10: Attached files: C:\Users\Mark\AppData\Local\Temp\WER7DC.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\Mark\AppData\Local\Microsoft\Windows\WER\ReportArchive \AppCrash_generatortestbed_4fa7dff09a9e893eb675f488392571ced4ac8_04ef1100 Analysis symbol: […]

在PresentationFramework.dll中发生了System.Windows.Markup.XamlParseException?

我在C#上使用WPF作为代码如下 //My GUI Code here 当我运行应用程序时,它将抛出以下exception An unhandled exception of type ‘System.Windows.Markup.XamlParseException’ occurred in PresentationFramework.dll Additional information: ‘The invocation of the constructor on type ‘DVRClientInterface.MainWindow’ that matches the specified binding constraints threw an exception.’ Line number ‘9’ and line position ‘5’. If there is a handler for this exception, the program may be safely continued. […]