I have a problem that has puzzled me for some time now. On a WPF/.NET 3.5 product I have released, about 1 out of 100 installs will not be able to run the software at all due to the following error:
System.Windows.Markup.XamlParseException: Failed object initialization (ISupportInitialize.EndInit). The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Error at object 'System.Windows.Controls.MenuItem' in markup file 'mainwindow.xaml'.
This is puzzling for three reasons:
This only happens on about 1 to 2 percent of installs.
There is nothing unusual as far as I can tell about the .NET installations or OS on these systems.
This is happening with a default framework reference (System.Windows.Controls.MenuItem)
Can anyone think of possible causes for this?
EDIT: After following the tip from "500", I was able to run the Fusion log viewer on the customer machine. On the development machine and all other test machines, there are successful binding attempts on "PresentationFramework" and "PresentationFramework.Aero", which are expected. On the client machine, there is an additional binding attempt that fails (Irrelevant lines removed):
*** Assembly Binder Log Entry (2/3/2013 @ 1:18:44 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = PresentationFramework.Dawn TOP, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: PresentationFramework.Dawn TOP, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/My App/PresentationFramework.Dawn TOP.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/My App/PresentationFramework.Dawn TOP/PresentationFramework.Dawn TOP.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/My App/PresentationFramework.Dawn TOP.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/My App/PresentationFramework.Dawn TOP/PresentationFramework.Dawn TOP.EXE.
LOG: All probing URLs attempted and failed.
A Google search for "PresentationFramework.Dawn" returns no results and I cannot locate any reference to this file. Any explanation or additional tests that can be done?
EDIT 2: It turns out that the customer had installed an unofficial Windows 7 Aero theme called "Dusk". For some reason, PresentationFramework decided to make a call to PresentationFramework.Dusk instead of PresentationFramework.Aero (a reference that I explicitly included in the project). I'm assuming that the error is the result of a bad installation of the 3rd party theme since Dusk cannot be found in the GAC, but can you shed any light on how I might stop the reference from being attempted and force all GUI elements to use PresentationFramework.Aero?