为什么System.Core程序失败的Silverlight 5应用程序添加编码的UI支持时加载? [英] Why System.Core fails to load when adding Coded UI support for Silverlight 5 application?
问题描述
我有以下问题:
试图增加对Silverlight的5应用程序创建编码的UI测试支持([MSDN] [1])。第一步是引用在Silverlight 5项目装配Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll。不幸的是,参考已经被添加之后,项目停止了一些类似的错误编译:
>
错误25无法解析引用程序集。请参阅相关组件。无法加载文件或程序集System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e'或它的一个依赖。找到的程序集清单定义不匹配程序集引用。 (异常来自HRESULT:0x80131040).... \ErrorReportDialog.xaml
貌似System.Core程序5.0.5.0加载失败,还好,装配调试与Fuslogw加载产生两个有趣日志:
第一次登录:
>大会粘结剂日志条目(2013年4月3日14时07分49秒@)
手术很成功。
连接结果:HR =为0x0。操作已成功完成。 C::
大会经理从加载\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
下可执行的C运行:\Windows\Microsoft.NET\\ \\Framework\v4.0.30319\MSBuild.exe
详细的错误日志如下。
===预绑定状态信息===
日志:显示名称= System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e
(完全指定)
日志:应用平台=文件:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/
日志:初始PrivatePath = NULL
日志:动态基= NULL
日志:缓存基= NULL
日志:AppName的= MSBuild.exe
调用汇编:System.Windows,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e。
日志:此绑定LoadFrom加载上下文开始。
警告:本机映像不会LoadFrom上下文进行探测。本机映像将只默认加载上下文中进行探测,像的Assembly.Load()。
日志:使用应用程序配置文件:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config
日志:使用主机配置文件:
日志:从C使用计算机配置文件:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config。
日志:后政策参考:System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e
日志:绑定成功。从C返回总成:\Program文件(x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Core.dll。
日志:大会加载LoadFrom加载上下文。
貌似System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e负载成功地。
,而第二个日志条目产生以下错误:
>大会粘结剂日志条目(2013年4月3日14时07分49秒@)
操作失败。
连接结果:HR = 0x80131040。没有可用的描述。 C::
大会经理从加载\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
下可执行的C运行:\Windows\Microsoft.NET\\ \\Framework\v4.0.30319\MSBuild.exe
详细的错误日志如下。
预绑定状态信息
日志:显示名称= System.Core程序,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e
(完全指定)
日志:应用平台=文件:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/
日志:初始PrivatePath = NULL
日志:动态基= NULL
日志:缓存基= NULL
日志:AppName的= MSBuild.exe
调用汇编:Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper,版本= 10.0.30319.381,文化=中性公钥= b03f5f7f11d50a3a。
日志:此绑定的默认加载上下文开始。
日志:使用应用程序配置文件:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config
日志:使用主机配置文件:
日志:从C使用计算机配置文件:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config。
日志:重定向在应用程序配置文件中找到:2.0.5.0重新定向到5.0.5.0。
日志:后政策参考:System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e
日志:相同的绑定被视为前,并失败,HR = 0x80131040。
ERR:下载前检查(HR = 0x80131040)过程中发生不可恢复的错误。
看起来像Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll尝试加载System.Core程序,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e,但被重定向到System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e(从第1记录已经加载),仍然无法加载。
任何人都可以提供关于如何进一步调试这个问题的一些见解?我对编译平台值为anycpu Silverlight的项目。
[1]:http://msdn.microsoft.com/en-us/library/gg413374.aspx
要确认System.Core程序版本由SilverlightUIAuthomationHelper需要执行以下操作:
- 找到磁盘上的引用SilverlightUIAuthomationHelper DLL。在任何反汇编/反射
- 加载它 - 例如dotPeek或反思。
- 引用的程序集的检查版本 - System.Core程序必须是2.0.5.0在SilverlightUIAuthomationHelper版本
可能的解决方案:
- 更新SilverlightUIAuthomationHelper到新版本(链接在汉斯帕桑特评论)引用新System.Core程序的DLL(版本5.0.5.0)
- 因为fuslogvw说,从2.0.5.0至5.0.5.0位于应用程序配置文件重定向 - 试图找到并删除此重定向(的细节这里)。但它很可能是别的东西会打破。
I'm having the following problem:
Trying to add support for creating coded UI test for Silverlight 5 application ([MSDN][1]). First step is to reference assembly Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll in Silverlight 5 project. Unfortunately, after the reference has been added, projects stops to compile with a number of similar errors:
>
Error 25 Cannot resolve reference assemblies. Please check the reference assemblies. Could not load file or assembly 'System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ....\ErrorReportDialog.xaml
Looks like System.Core 5.0.5.0 fails to load, okay, debugging assemblies loading with Fuslogw produces two interesting logs:
First log:
> Assembly Binder Log Entry (04.03.2013 @ 14:07:49)
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
(Fully-specified)
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e.
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
LOG: Binding succeeds. Returns assembly from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Core.dll.
LOG: Assembly is loaded in LoadFrom load context.
Looks like System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e loads succesfully.
But second log entry produces the following error:
> Assembly Binder Log Entry (04.03.2013 @ 14:07:49)
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
A detailed error log follows.
Pre-bind state information
LOG: DisplayName = System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
(Fully-specified)
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper, Version=10.0.30319.381, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 2.0.5.0 redirected to 5.0.5.0.
LOG: Post-policy reference: System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
LOG: The same bind was seen before, and was failed with hr = 0x80131040.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80131040).
Looks like Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll tries to load System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, but is being redirected to System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (already loaded from 1st log) and still fails to load.
Can anyone provide some insight on how to further debug this problem? I'm compiling Silverlight projects for AnyCpu platform.
[1]: http://msdn.microsoft.com/en-us/library/gg413374.aspx
To confirm version of System.Core required by SilverlightUIAuthomationHelper do the following:
- find the referenced SilverlightUIAuthomationHelper dll on disk.
- load it up in any disassembler/reflector - for example dotPeek or Reflector.
- check versions of referenced assemblies - System.Core must be 2.0.5.0 in your version of SilverlightUIAuthomationHelper
Possible solutions:
- update SilverlightUIAuthomationHelper to the new version (link in the Hans Passant comment) that references new System.Core dll (version 5.0.5.0)
- Because fuslogvw says that redirect from 2.0.5.0 to 5.0.5.0 is located in the APPLICATION configuration file - try to find and remove this redirect (details here). But it is very possible that something else will break.
这篇关于为什么System.Core程序失败的Silverlight 5应用程序添加编码的UI支持时加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!