-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version mismatches in 2.1 and 2.2 patch updates (often causes FileLoadException) #3503
Comments
I found issue similar to symptom 2, but with some differences: I have ASP.NET Core application (Microsoft.AspNetCore.App 2.1.2) FDD deployed to Azure App Service (West Europe). Everything worked fine for three weeks but 19/09/2018 all of the sudden it starts to fail. I tryied dotnet tool on App Service (Kudu) and there is only App/All runtime version 2.1.1 and 2.1.4 on the machine. My csproj file contains:
and it is failing on this error:
I tryied to change the file this way:
but the error remains. When I explicitly change Sqlite version this way:
it works. But Microsoft.EntityFrameworkCore.Sqlite is not a part of ASP.NET Core runtime (App). It is very unpleasant to know that the application can whenever fall down. I found that only safe solution is to deploy application as self-contained. Any ideas how to figure out this issue? |
@mholec did you try Workaround 2? |
I can try it. However the problem is that this kind of error means that my web application my be broken at any time after successful deploy and test. |
We have a fix for the issue in 2.1.5 which should be out soon, so only 2.1.1 through 2.1.4 should be affected by this issue. When 2.1.5 is released, I recommend you update your servers. |
I have verified the fix is in 2.1.5 which will be released soon. Fixed with dotnet/core-setup#4521 |
I recently experienced this problem, only for adding more info my problems was that the runtime was higher than my references so like the solution from giorgio I only updated the EF.Tools vía nuget |
This issue has resurfaced in 2.1.7. We are investigating the cause. I believe the workarounds mentioned above should continue to work to resolve this. @hobbify in your case, try Workaround 2. The cause of the problem now is an incomplete .deps.json file in the Microsoft.AspNetCore.App shared framework. It does not contain all the information it needs to about assembly versions. For example, look at C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\2.1.7\Microsoft.AspNetCore.App.deps.json By contrast, 2.1.6 has the right metadata on "runtime" entries. "runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Core.dll": {
"assemblyVersion": "2.1.3.0",
"fileVersion": "2.1.3.18263"
}
} In 2.1.7, this metadata is missing. "runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Core.dll": {}
} |
@natemcmaster For workaround 2 what version do you recommend? From comparing different app services created during our deployments different run-time versions are available. I can try with 2.1.6 |
Wherever possible, I recommend the latest, 2.1.7, but it depends on your hosting server. The version you specify will be your application's minimum. If your hosting server doesn't have ASP.NET Core >= version, your app fail with "It was not possible to find any compatible framework version". |
…2.1.0 The 2.0 version of the Microsoft.Extensions.DependencyModel does not support the assembly/file version metadata. We must have at least 2.1. Between 2.1.6 and 2.1.7, we switched the build to use MSBuild.exe ("full" MSBuild) instead of `dotnet msbuild` ("core" MSBuild). MSBuild has different assembly loaders behaviors in core vs full. By switching MSBuild types, we were also unintentionally switching the version of Microsoft.Extensions.DependencyModel.dll that was being used by our build task from 2.1 back down to 2.0. The reason we didn't discover this in earlier 2.1.x patches is that building on msbuild core automatically upgraded our build tasks to Microsoft.Extensions.DependencyModel.dll, Version=2.1.0.0. This happens because of differences in the way .NET Core and MSBuild handles assemblies with the same ID and different versions, and differences in the layout of MSBuild and the .NET Core CLI. In the end, this happened because we didn't have test coverage. MSBuild and custom tasks burned asagain, but we should have just had unit tests all along, which would have uncovered this regression as soon as we switched to msbuild.exe.
Proposed fix => #6619. It needs to go through approval channels first, but assuming that happens, this will be fixed in 2.1.8 and 2.2.2. |
After installing Version 2.1.8 I'm running into issues with apps compiled using:
Installing the update on our servers would make them all crash with:
We stopped the rollout of the newest update for now, but
|
Same issue here, using
When removing the explicit version, the app works, but I'm afraid of the impact of unwanted updates. If we remove the version, will it always stay in the 2.1.x branch? I'm fine with having an explicit version here since I'm redistributing the runtime with my app ( |
Okay, using Version 2.1.6 instead of 2.1.7 seems to work with 2.1.7 and 2.1.8. Welcome to .NET Core Version Hell. Thus, we need to downgrade our apps to 2.1.6 and wait with the rollout of 2.1.8 until every rollout of our apps is done. Does that make sense? Is that really necessary or is there a better way? |
Ad Workaround 1) That does not help, if an app references some non Microsoft package, which references some |
I've opened #7546 to resolve the 2.1.7 -> 2.1.8 issue which causes You are correct that Workaround 1 does not work if you depend on other things which pull in AspNetCore transitively packages. We're addressing this in 3.0 with a fundamental redesign of the way we version and distribute aspnetcore packages and assemblies. In the meantime, use Workaround 2.
By default, .NET Core will run on the highest patch version of 2.1.* installed on the machine, regardless of the presence/absence of the When you remove the explicit version attribute and build a self-contained application ( If you want to further control the way in which your application rollsforward (or does not rollforward) to new versions, checkout instructions here: https://natemcmaster.com/blog/2019/01/09/netcore-primitives-3/#automatically-run-on-higher-patch-versions |
It would seem this is still an issue with .Net Core 3.0 |
@replaysMike please open a new issue with more details about your problem. This one has been closed for a long time. |
Some ASP.NET Core 2.1 users have been affected by a bug in the .NET Core host (see https://github.com/dotnet/core-setup/issues/4512) which can cause apps to fail with System.IO.FileLoadException. The issue may also be present in your app, even if the app does not fail with System.IO.FileLoadException.
Affected versions
.NET Core, 2.1.1 through 2.1.4 (all OSes), 2.1.7 (Windows only), 2.2.1 (Windows only)
Symptom 1
ASP.NET Core apps running on the Microsoft.AspNetCore.App shared framework may fail to run after the machine-wide version of .NET Core is updated. Apps fail with an error such as:
Symptom 2
When publishing an ASP.NET Core application which references Microsoft.AspNetCore.App, additional Microsoft assemblies are in the publish output.
For example, if you run
dotnet publish --output PublishDir/
and you seeMicrosoft.Extensions.*.dll
orMicrosoft.AspNetCore.*.dll
files inPublishDir/
, you may be running into this issue.Cause
This issue is typically caused by .csproj files which have a PackageReference to a package which is already part of Microsoft.AspNetCore.App.
For example,
The Microsoft.AspNetCore.SignalR package is already pulled in as a part of Microsoft.AspNetCore.App, so does not normally need to be referenced. The presence of this reference causes a mismatch of versions, which in turn causes a problem with the .NET Core host, as described in https://github.com/dotnet/core-setup/issues/4376.
More technical details here: Azure/app-service-announcements-discussions#65 (comment)
Workaround 1
Remove PackageReference's which are already part of Microsoft.AspNetCore.App. You can find a list of what this package pulls in by looking at https://www.nuget.org/packages/microsoft.aspnetcore.app#show-dependency-groups. This will avoid the version mismatch.
Workaround 2
Upgrade the Microsoft.AspNetCore.App PackageReference to the latest 2.1.x version by adding the
Version
attribute.The text was updated successfully, but these errors were encountered: