WPF Performance Suite抛出BadImageFormatException

时间:2013-05-06 10:26:51

标签: wpf

我需要分析我的WPF 4.0应用程序。当我尝试在WPF Performance Suite 4.0(来自Windows SDK 7.1)中打开它时会抛出BadImageFormatException

enter image description here

它抱怨更新的运行时,所以我在corflags上运行exe来检查运行时版本。它说:

Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32
CorFlags  : 1
ILONLY    : 1
32BIT     : 0
Signed    : 0

怎么了?为什么我无法在分析器中打开此WPF应用程序?

更新

试过JeffRSon提出的另一个例外:

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at Microsoft.WpfPerformance.ToolAssembly..ctor(Assembly assembly)
   at Microsoft.WpfPerformance.Controls.AddToolDialog.ScanAssembly(String filename)
   at Microsoft.WpfPerformance.Controls.AddToolDialog.ScanAssembly()

1 个答案:

答案 0 :(得分:3)

WpfPerf_managed.exe.config或安装WPF Performance Suite的位置创建名为C:\Program Files\Microsoft Windows Performance Toolkit\WPF Performance Suite的文件,其中包含以下内容:

<?xml version="1.0"?>
<configuration>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
   </startup>
</configuration>

这可以在一个过程中实现并行运行时。

重新启动WPF Performance Suite并加载程序集。