In my WPF application, I get the following exception on startup:
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.
EDIT: Using fusion log, I get a little more valuable info than the call stack:
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.
What I find strange, is that the calling assembly is PresentationFramework
, which is a .NET framework assembly, obviously. A .NET Framework assembly wouldn't call an assembly which is not a .NET framework assembly. Anyway, I can't find a PresentationUI.Aero2.DLL anywhere and not even Google seems to know anything about it??
Any ideas?
Additional information:
If you're interested, this is a (benign) bug in WPF. The exception is first-chance and can be ignored.
WPF forgot to add Aero2.NormalColor.xaml
to PresentationUI.dll
. If you inspect PresentationUI.dll
with your favorite reflector/decompiler, you'll find all sorts of themes, such as Aero.NormalColor.baml
, etc. but no Aero2.NormalColor.xaml
. This causes WPF to try and see if an external assembly exists:
This tries to load Aero2.NormalColor.baml
from PresentationUI.dll
and returns null
:
http://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/SystemResources.cs,773
This then goes to try an external assembly: http://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/SystemResources.cs,554
And this throws the actual exception: http://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/SystemResources.cs,706
This exception is commonly observed when using a FlowDocument
or a FlowDocumentScrollViewer
.
I was getting the same error and finally realized that it was simply stopping in the IDE because I had first chance exceptions turned on, the exception doesn't actually matter and you can ignore or continue past it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With