"无法加载文件或程序集'PresentationUI.Aero2'或其依赖项之一." 为什么不?

Mar*_*arc 10 c# wpf dll

在我的WPF应用程序中,我在启动时遇到以下异常:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

Additional information: Could not load file or assembly 
'PresentationUI.Aero2, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 
or one of its dependencies. 
Run Code Online (Sandbox Code Playgroud)

编辑:使用融合日志,我得到比调用堆栈更有价值的信息:

LOG: DisplayName = PresentationUI.Aero2, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///[...]/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = EngideskLauncher.vshost.exe
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: [...]\bin\Debug\EngideskLauncher.vshost.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: PresentationUI.Aero2, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///[...]/bin/Debug/PresentationUI.Aero2.DLL.
LOG: Attempting download of new URL file:///file:///[...]/bin/Debug/PresentationUI.Aero2/PresentationUI.Aero2.DLL.
LOG: Attempting download of new URL file:///file:///[...]/bin/Debug/PresentationUI.Aero2.EXE.
LOG: Attempting download of new URL file:///file:///[...]/bin/Debug/PresentationUI.Aero2/PresentationUI.Aero2.EXE.
LOG: All probing URLs attempted and failed.
Run Code Online (Sandbox Code Playgroud)

我觉得奇怪的是,调用程序PresentationFramework集显然是一个.NET框架程序集..NET Framework程序集不会调用不是.NET框架程序集的程序集.无论如何,我无法在任何地方找到PresentationUI.Aero2.DLL,甚至谷歌似乎对此一无所知?

有任何想法吗?

附加信息:

  • .NET Framework 4.0
  • Windows 8.1

Kir*_*kov 16

如果您有兴趣,这是WPF中的(良性)错误.例外是第一次机会,可以忽略.

WPF忘了补充Aero2.NormalColor.xamlPresentationUI.dll.如果您PresentationUI.dll使用自己喜欢的反射器/反射器进行检查,您会发现各种主题,例如Aero.NormalColor.baml等等但不是Aero2.NormalColor.xaml.这会导致WPF尝试查看是否存在外部程序集:

这种尝试加载Aero2.NormalColor.bamlPresentationUI.dll返回null: http://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/SystemResources.cs,773

然后尝试外部程序集:http: //referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/SystemResources.cs,554

这引发了实际的异常:http: //referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/SystemResources.cs,706

使用a FlowDocument或a 时通常会出现此异常FlowDocumentScrollViewer.


Bra*_*AGr 2

我遇到了同样的错误,最后意识到它只是在 IDE 中停止,因为我打开了第一次机会异常,异常实际上并不重要,您可以忽略或继续过去。