Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Could not load file or assembly System.Core, Version=2.0.5.0 #212

Closed
fredericoregateiro opened this issue Jun 15, 2016 · 32 comments
Closed

Comments

@fredericoregateiro
Copy link

I've just got this error, on a app using Live-charts.
I tested on 2 pc's and they both have .net 4.5 installed, this error should only if the .net 4.0 not patched is installed?

System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
at LiveCharts.ChartValues`1.GetLimits()
at LiveCharts.ChartUpdater.Update(Boolean restartsAnimations)
at LiveCharts.Wpf.Components.ChartUpdater.UpdaterTick()
at LiveCharts.Wpf.Components.ChartUpdater.<.ctor>b__0_0(Object sender, EventArgs args)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Jun 16, 2016

Are you sure both are running .net 4.5?

I think one of your machines have windows xp, does it?

It seems that you are running on .net 4.0 and you are missing the latest patch to support portable libraries

https://support.microsoft.com/en-us/kb/2468871

@fredericoregateiro
Copy link
Author

No, that's the weird part, one have Windows 8 and the other Windows 10!

@fredericoregateiro
Copy link
Author

I've notice that the LiveCharts.Core.dll is a portable library, did you choose this type of project over a shared library for any reason?

I just recompile your source code and fix this error, but i created a shared library and reference the wpf view project to the project i create, and the error was gone.

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Jun 16, 2016

0.7 is designed to be a cross .net library, and Xamarin says that portable libraries are the preferred method.

Xamarin is the main target of this library, this technology is growing really fast, LiveCharts needs to be there!

https://xamarinhelp.com/portable-class-library-pcl-vs-shared-projects/

@beto-rodriguez
Copy link
Collaborator

So you first used the Nuget .dll and the error was there? then used the dll you compiled with the source code and it got fixed?

@fredericoregateiro
Copy link
Author

Yes first i was using the nuget dll's, but to fix the error i created a shared project and copied all the files from the Core project.
So in the end i reference only one dll from my application, and this way produced no errors.
I think that the problem is that the code is compiled on .net 4.0, and System.Core 2.5 doesn't exist in .net 4.0, but in a patch released after KB2468871.
http://www.hanselman.com/blog/FixingSystemCore205FileLoadExceptionPortableLibrariesAndWindowsXPSupport.aspx

All the pc's i've tested also have .net 4.0 and 4.5 installed, but the patch is not, and because it's a pain to tell all my customers that that have to install a path to continue to use my app, so i preferre not to go that way.

It's great to hear that this project has eyes for the future, that's why i've chosen it over others.
The Shared vs PCL needs to be analysed case by case, in my opinion, they both have advantages and disadvantages.
For me, if i need to share the code with others, then the PCL is the way to go, but if i use it only for refactoring and it's never going to live outside my solution then it's shared project.
https://docs.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/

Other say that the PCL give move pain to the developers
http://tirania.org/blog/archive/2016/Jan-22.html

@fredericoregateiro
Copy link
Author

If you want to take a look in the changes i've made:
https://1drv.ms/u/s!Ag_dYVHDqujNiTv6OJc0UEHlBYlN

@beto-rodriguez
Copy link
Collaborator

Thanks!

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Jun 19, 2016

I really appreciate the code your shared with me, I added the "help wanted" label in case some one is interested in give us his/hers opinion.

The problem is totally the patch, portable libraries are only supported in .net 4.0.3 not in 4.0, I need to remove this build since it could fail depending whether the patch is installed in the target machine.

With this LiveCharts needs at least WindowsXP SP3, I will add this note to the repo readme file

For now I will only stop building for .net 4.0, the build will start at 4.0.3 this way I force your app install this update installed to run LiveCharts.

I now maybe it is hard to notify your customers to install this patch, I am not totally sure about it but this could be done telling your installer that you need at least .net 4.0.3 it should force your customers to install the patch "automatically", at least it should notify them.

Another helpful link http://stackoverflow.com/questions/11559156/how-can-i-change-the-targeted-framework-from-4-0-to-4-0-3

@rohit3d2003
Copy link

I like this approach of automatically forcing the app to install the patch. I believe we should stick with portable libraries since this is what Microsoft is promoting as well for their future app development and a way to go for every developer

@fredericoregateiro
Copy link
Author

@beto-rodriguez Good to know that this can be fixed easily on your side. On my side i have no problems using .NET 4.0.3.
I will try to change to .NET 4.0.3 on your source code and do some tests

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Jun 20, 2016

Officially from 0.7.3.1 to next versions support for .net 4.0 was dropped, your app must target 4.0.3 or greater

Added a .bat file to help the building process, the build should be available for everyone now, everything is here to build all the net versions and projects just clicking the LiveCharts.pack.bat file

@K3v1
Copy link

K3v1 commented Aug 10, 2016

I am having the same problem despite .net 4.5. (Win7, VS Studio Express 2013)
The exception occurs if I add a CartesianChart to the usercontrol.xaml, but AngularGauge for example works.

Here is the stack trace:
FileNotFoundException: Die Datei oder Assembly "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden
bei LiveCharts.Charts.CartesianChartCore.PrepareAxes()
bei LiveCharts.ChartUpdater.Update(Boolean restartsAnimations)
bei LiveCharts.Wpf.Components.ChartUpdater.UpdaterTick(Boolean restartView)
bei LiveCharts.Wpf.Components.ChartUpdater.<.ctor>b__0_0(Object sender, EventArgs args)
bei System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

@K3v1
Copy link

K3v1 commented Aug 11, 2016

image

These two components cause the error (the others not!).

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Aug 11, 2016

This issue is directly related with https://www.microsoft.com/en-us/download/details.aspx?id=3556

If you install that patch you wont have the issue anymore, what scares me the most is the idea that net 4.5 is not patched already!

I think if you change your app to target .net 4.5.1 or 4.5.2 will solve the issue also, need to investigate further on this.

@K3v1
Copy link

K3v1 commented Aug 12, 2016

The installation was not successfull:
image
-> KB2468871v2 does not fit or is blocked by another condition on your system.

4.5.1 and 4.5.2 do not solve the issue.

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Aug 12, 2016

Are you on windows xp sp3?

Please check the system requirements of that patch.

https://www.microsoft.com/en-us/download/details.aspx?id=3556

Live-Charts requires that patch to run correctly

@K3v1
Copy link

K3v1 commented Aug 12, 2016

No, that is on Windows 7.
Maybe a company specific policy blocks the update.

I finished my project with WPF Toolkit which is not as pretty as Live-Charts, but I met the deadline.
Thank you for your fast response and these great charts. I will try it in my next project.

@beto-rodriguez
Copy link
Collaborator

I hope a 1.0 version is ready in your next project, trying to get high performance ready asap

@SergDev87
Copy link

SergDev87 commented Oct 21, 2016

I can not run the application on Windows XP. Install updates KB2468871.
In Windows 10, all works fine.

P.S. Applications compiled with .Net Framework 4.0 are working

@beto-rodriguez
Copy link
Collaborator

What is the error you get?

@SergDev87
Copy link

Not a valid Win32 application

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Oct 21, 2016

How about if you install https://www.microsoft.com/en-us/download/details.aspx?id=29053

Also ensure you are compiling in .net 4.0.3

@SergDev87
Copy link

I installed this update

@SergDev87
Copy link

SergDev87 commented Oct 21, 2016

@SergDev87
Copy link

SergDev87 commented Oct 21, 2016

Also ensure you are compiling in .net 4.0.3

http://s017.radikal.ru/i417/1610/ba/f649ecf7e9b6.png

@beto-rodriguez
Copy link
Collaborator

I am really not sure what could be wrong, I will reopen this issue, and wait for feed back from users, everyone please let us know if you can use the library in XP

@SergDev87
Copy link

SergDev87 commented Oct 22, 2016

No application wants to work if it is assembled under 4.0.3 (Windows XP) When doing the assembly under 4.0 everything is fine. Only sorry your library doesn't support 4.0

@beto-rodriguez
Copy link
Collaborator

Windows XP SP3 right?

@SergDev87
Copy link

Yes, Windows XP service pack 3.

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Nov 14, 2016

I am done with issue, in the referenced commits bellow I added a new project targeting net40, it is just a copy paste of the core project, since it targets 4.0.3, I am sure there should be a way to compile the current code in net 40 since it requires no changes, but for now this works.

Since version 0.8 I will provide both builds in the nuget package

  1. Net40
  2. Portable class library profile 328 (the current one)

@SergDev87
Copy link

Thank you! Checked, everything works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants