901222-Silverlight应用程序在运行时在xaml中引发异常 [英] 901222 - Silverlight application throws an exception in xaml when running

查看:102
本文介绍了901222-Silverlight应用程序在运行时在xaml中引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我不知道我做了什么更改,导致我的程序无法正常工作.运行时说:

类型为'System.Windows.Markup.XamlParseException'的第一次机会异常发生在System.Windows.dll中
附加信息:匹配指定绑定约束的类型为"gis.GISViewModel"的构造函数的调用引发了异常. [Line:12 Position:33] 


在xaml中,该位置是我从视图模型实例化的位置.看来我无法从视图模型实例化,因为当我在代码后面创建实例时,它也引发了异常.
我认为这可能是因为我在多个源文件中分离了视图模型类,并为此使用了部分关键字.但是当我重新加入文件时,我没有任何变化.
有任何线索吗?
thx

解决方案

以下是我建议您可以尝试的方法:

1.检查是否已启用非托管调试(在项目属性"->调试"中)
2.找出您的C ++/CLI DLL是否存在实现Winforms控件的依赖项,以及这些依赖项是否无法解析.
为了找出对本机DLL的依赖性,您应该使用工具Dependency Walker(depends.exe). .NET Reflector将仅检查托管依赖项.
3.逐步注释掉用户控件的代码,然后重试.
4.使用Gflags.exe打开加载程序快照


hi i don''t know what change i made that caused my program not to work anymore. when running it say:

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.dll
Additional information: The invocation of the constructor on type 'gis.GISViewModel' that matches the specified binding constraints threw an exception. [Line: 12 Position: 33]


in the xaml, the location is where i instantiate from view model. it seems that i can''t instantiate from view model, because when i created an instance in code-behind it also raised an exception.
i thought it might be because i separated view model class in more than one source file and used partial keyword for it. but when i rejoined the files i got no change.
any clue?
thx

解决方案

Here are my suggestions that you could try:

1.Check if you have enabled unmanaged debugging (in Project Properties -> Debug)
2.Find out if there are any dependencies your C++/CLI DLL where the Winforms control is implemented and if those dependencies cannot be resolved.
In order to find out dependencies on native DLLs, you should use the tool Dependency Walker (depends.exe). .NET Reflector will only examine managed dependencies.
3.Comment out code of your User Control step by step and try again.
4.Use Gflags.exe to turn on Loader Snaps


这篇关于901222-Silverlight应用程序在运行时在xaml中引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆