Silverlight 应用程序因 System.Windows.Controls 中的 FileNotFoundException 而损坏

发布于 2024-08-18 10:45:37 字数 1451 浏览 7 评论 0原文

我一直致力于将 Silverlight 项目从 Silverlight 2 转换为 Silverlight 3。请注意,我从未在我的计算机上安装过 SL 2 二进制文件或开发组件(它只有一个月的历史)。

一切进展顺利,应用程序一直运行,直到我开始收到构建错误,ValidateXamlSystem.Core 中引发 FileNotFoundException。我不知道为什么会突然发生这种情况,但通过一些搜索,答案似乎是将各种 Silverlight DLL 放入 GAC 中。这确实解决了构建错误。之后我没有尝试测试该应用程序是否正常运行。

一段时间后,我尝试再次运行该应用程序。现在,我又遇到了一个 FileNotFoundException,这次是在 System.Windows.Controls 中。我尝试从 GAC 中删除所有 Silverlight DLL,然后再次将它们添加回来,但没有成功。这是堆栈跟踪:

Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at MyNamespace.Page.InitializeComponent()
   at MyNamespace.Page..ctor()
   at MyNamespace.App.Application_Startup(Object sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)     

整个经历非常令人沮丧,我很想知道是什么导致了这些问题以及如何解决它们?

I've been working on converting a Silverlight project from Silverlight 2 to Silverlight 3. Note that I've never had SL 2 binaries or development components installed on my machine (it's only a month old).

This has been going fine and the app was running until I started getting a build error with ValidateXaml raising a FileNotFoundException in System.Core. I don't know why this suddenly started happening but from some searching around the answer seemed to be putting various Silverlight DLLs in the GAC. This did indeed solve the build errors. I didn't try testing to check if the app ran correctly after that.

Some time later I'm trying to run the app again. Now I'm getting yet another FileNotFoundException, this time in System.Windows.Controls. I've tried removing all Silverlight DLLs from the GAC and adding them back in again without any success. Here's the stack trace:

Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at MyNamespace.Page.InitializeComponent()
   at MyNamespace.Page..ctor()
   at MyNamespace.App.Application_Startup(Object sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)     

This entire experience has been very frustrating and I'd love to know what is causing these problems and how to fix them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十年不长 2024-08-25 10:45:37

您尝试过融合日志查看器吗?在 VS 命令 shell 中,fuslogvw.exe,将其设置为在选项中显示绑定错误,清除日志,运行您的应用程序。然后它会详细解释为什么无法加载程序集。 fuslogvw 在这里帮助了我很多次。

请注意或其依赖项之一。这是关键,很少有异常是在抱怨程序集,这通常是依赖问题。

Have you tried the fusion log viewer? In a VS command shell, fuslogvw.exe, set it to show bind errors in options, clear out the log, run your app. Afterwards it will give you a detailed explanation why it could not load the assembly. fuslogvw has helped me here many times.

Do note the or one of its dependencies. That is key, it's rare that it's the assembly the exception is complaining about, it's often a dependency issue.

暮凉 2024-08-25 10:45:37

我已经重新安装了 Silverlight 运行时和所有开发组件,问题现在已经消失了。

我暂时不回答这个问题,以防有人对造成此问题的原因有一些想法。

I have reinstalled the Silverlight runtime and all of the development components and the problem has now gone away.

I'm leaving this unanswered for now in case someone has some ideas on what caused this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文