Sto riscontrando il seguente problema:Perché System.Core non riesce a caricare quando si aggiunge il supporto codificato dell'interfaccia utente per l'applicazione Silverlight 5?
Tentativo di aggiungere supporto per la creazione di un test dell'interfaccia utente codificato per l'applicazione Silverlight 5 ([MSDN] [1]). Il primo passo è fare riferimento all'assembly Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll nel progetto Silverlight 5. Purtroppo, dopo è stato aggiunto il riferimento, i progetti si ferma a compilare con una serie di errori simili:
>
Error 25 Cannot resolve reference assemblies. Please check the reference assemblies. Could not load file or assembly 'System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ....\ErrorReportDialog.xaml
Looks like System.Core 5.0.5.0 fails to load, okay, debugging assemblies loading with Fuslogw produces two interesting logs:
First log:
> Assembly Binder Log Entry (04.03.2013 @ 14:07:49)
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
(Fully-specified)
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e.
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.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: System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
LOG: Binding succeeds. Returns assembly from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Core.dll.
LOG: Assembly is loaded in LoadFrom load context.
Looks like System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e loads succesfully.
But second log entry produces the following error:
> Assembly Binder Log Entry (04.03.2013 @ 14:07:49)
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
A detailed error log follows.
Pre-bind state information
LOG: DisplayName = System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
(Fully-specified)
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper, Version=10.0.30319.381, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.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: Redirect found in application configuration file: 2.0.5.0 redirected to 5.0.5.0.
LOG: Post-policy reference: System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
LOG: The same bind was seen before, and was failed with hr = 0x80131040.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80131040).
Sembra Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll tenta di caricare System.Core, Version = 2.0.5.0, Culture = neutral, PublicKeyToken = 7cec85d7bea7798e, ma viene reindirizzato a System.Core, Versione = 5.0.5.0, Culture = neutral, PublicKeyToken = 7cec85d7bea7798e (già caricato dal 1 ° registro) e continua a fallire caricare.
Can anyone provide some insight on how to further debug this problem? I'm compiling Silverlight projects for AnyCpu platform.
[1]: http://msdn.microsoft.com/en-us/library/gg413374.aspx
System.Core, versione = 2.0.5.0 è ovviamente il problema. Una versione precedente dell'assembly, utilizzata nelle versioni precedenti di Silverlight. Non l'hanno fatto per VS2012, controlla questo [post di blog] (http://blogs.msdn.com/b/bharry/archive/2012/07/09/coded-ui-testing-support-for-silverlight aspx). –
L'ho controllato con VS2010 - il reindirizzamento da machine.config non funziona lì. Produce un errore non riuscendo a trovare System.Core 2.0.5.0, poiché i riferimenti di progetto 5.0.5.0. Strano, dal momento che usiamo la stessa versione di .Net Framework stesso. – Cortlendt
@HansPassant: Pensi che sarebbe una buona idea postare quel link come risposta? So che non è una soluzione perfetta, ma penso che potrebbe essere l'opzione migliore. –