我需要分析我的WPF
4.0应用程序。当我尝试在WPF Performance Suite 4.0
(来自Windows SDK 7.1
)中打开它时会抛出BadImageFormatException
:
它抱怨更新的运行时,所以我在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()
答案 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并加载程序集。