I've got a project which has a Portable Class Library as "back-end" and a Universal Windows app for "front-end". Here is my repo at GitHub: huming2207/Rmiter
My target settings for the PCL library is "portable46-net451+win81", also the screenshot shows below:
When running the app it stuck at the beginning, showing a System.IO.FileLoadException from the backend PCL library, as below:
System.IO.FileLoadException: 'Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
...and here is the screenshot (in case if someone misunderstand my words):
But meanwhile I can see there was a "System.Runtime.dll" loaded when the app starts. But why it still throw exceptions later on?
I've searched and checked for quite a lot of similar issues and workarounds. But it seems that neither of them help at all.
Related
I created one sample cordova app using windows platform and added one test plugin , while calling native code through test plugin. I'm getting exception
WinRTError: The text associated with this error code could not be found.
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.WindowsRuntime, Version=4.0.11.0, Culture=neutral, PublicKeyToken=..'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at WindowImageAnnotation.ImageAnnotationPlugin.CreateImageAnnotation(String jsonString)
at module.exports.coolMethod (ms-appx-web://../www/plugins/cordova-plugin-imagewindow/src/windows/WindowImageProxy.js:25:11)
App Version:
Native code version:
This line throwing exception inside plugin, method is present in that variable "ev"
Exception:
Native code:
I changed the version also and tried but getting every time same exception. Any solution about this.
Will provide if anything required.
Thanks in Advance
Running App in Visual Studio Community 2017 15.9.30
I've added Microsoft.Bcl.Build/Microsoft.Bcl and Microsoft.Bcl.Async to some projects in my solution where I want to use async/await.
Everything works fine on my machine with .Net4.5 installed. However, when I start the application on a machine with only .Net4 installed, at some point, the application crashes with the following Exception:
Could not load file or assembly 'System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Looking at the StackTrace, the exception seems to be generated in a third party library that we reference.
When I analyze the Microsoft.Threading.Tasks.dll provided by Microsoft.Bcl.Async, I see that it does reference System.Threading.Tasks Version 1.5.11.0, but version 2.6.10.0 is included in Microsoft.Bcl.
Am I doing something wrong?
I found the solution! It was actually very simple. I just had to copy and paste the binding redirects that nuget adds in the app.config files into the *.exe.config file. Then it just magically works. Easy fix.
This exception occurs when i try to load my app on my device (lumia 950).
An exception of type 'System.IO.FileLoadException' occurred in Template10Library.DLL but was not handled in user code
Additional information: Could not load file or assembly 'System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
The environment: I'm using Template10 as a git submodule in my project instead of as a nuget package. I also have 2 other 'Class Library' projects and 1 'Windows Runtime Component' projects in my solution that my app depends on.
I'm a bit out of my depth here, I'm pretty new to app development and I have no clear understanding on the particulars of the windows build/deploy/runtime environment so I don't really know where to start.
I know you probably require more information in order to help me, so just ask and I'll try to get back to you.
Edit:
I added the following code in my app so that it ran before I got the exception above.
try
{
var assm = Assembly.Load(new AssemblyName("System.Threading"));
}
catch(Exception e)
{
System.Diagnostics.Debugger.Break();
}
By pausing the debugger at var assm ... I got the following information from the loaded assembly:
Fullname: "System.Threading, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
ImageRuntimeVersion: "v4.0.30319"
Location: "C:\windows\system32\SYSTEM.THREADING.NI.DLL"
So what does this mean? That my phone have older versions of system dll's? But why does my app require 4.0.10 when 4.0.0 should suffice?
EDIT 2:
I created a new blank app and a similar problem occured but this time with no library dependencies and this time I tried to use 'System.Net.Http.HttpClient' and I got the following exception:
An exception of type 'System.IO.FileLoadException' occurred in App1.exe but was not handled in user code
Additional information: Could not load file or assembly 'System.Net.Primitives, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I'm running OS build 10.0.10586.0 but I'm starting to consider that there is something wrong with my device.
Apparently my visual studio installation was messed up... so I did a complete reinstallation of the entire OS, and now it (and my apps) works properly.
Thank you Alan Yao for your input!
I have a website written in VS2010 that uses a web reference to a service that uses EnterpriseLibrary 5.0.414.0.
When i worked with VS2010 everything was ok, but once i opened it with VS2012 RTM i started getting the following error (i get the same error when i open the project in VS2010 too)
Reference.svcmap: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
Please advice.
This can happen if you are missing the other enterprise library blocks needed by the mentioned assembly (and copy local true as well), which are:
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.ServiceLocation.dll
Microsoft.Practices.Unity.Configuration.dll
Microsoft.Practices.Unity.dll
Microsoft.Practices.Unity.Interception.Configuration.dll
Microsoft.Practices.Unity.Interception.dll
I have 3 assemblies, a WP7 app (targeting 7.0), a Web Services project (running 4.0), and a Portable Class Library (built from the template & targeting WP7, SL4 & .NET 4.0) which contains a common type used between the first two.
When run locally (in IIS Express) things work just fine, however when run against a deployed instance of the Web Services assembly (on a remote IIS server I have little control of) fails with the following exception:
System.IO.FileNotFoundException: Could not load file or assembly
'System.Xml.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
system cannot find the file specified. File name:
'System.Xml.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' ---> System.IO.FileNotFoundException:
Could not load file or assembly 'System.Xml.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
Retargetable=Yes' or one of its dependencies. The system cannot find
the file specified. File name: 'System.Xml.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
Retargetable=Yes'
The stacktrace indicates that it is on the first call into the PCL, which would make sense if it's a type load failure like above.
If I remove the reference to the PCL assembly and then add the key class file to both assemblies, things work fine, however I want to avoid this kind of code duplication... so the question is: Why is this happening? How can I configure the PCL to function as written?
EDIT: A little more information... my PCL uses XmlSerializer, something that lives in System.Xml.dll on the desktop, and in System.Xml.Serialization.xml in Silverlight... an assembly that doesn't exist under the full desktop framework... so this failure makes some sense, only in the PCL world, some of these assemblies/classes are broken out on their own
In this case, XmlSerializer actually lives in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile2\System.Xml.Serialization.dll (which is referenced by the PCL)... as a test I added the same reference to the Web Project... however at runtime of the web project, it fails with yellow screen of death stating that:
Could not load file or assembly 'System.Xml.Serialization' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
You will need to install KB2468871 on the remote server. It's a GDR that has been pushed to most client machines - however, servers will need to opt into it (they typically don't automatically install updates).