Skip to content
This repository has been archived by the owner. It is now read-only.

After upgrading Asp.net core 1.1 to 2.0: "GetAsync does not have an implementation" #348

Closed
DeveloperUniversity opened this issue Aug 22, 2017 · 10 comments

Comments

@DeveloperUniversity
Copy link

@DeveloperUniversity DeveloperUniversity commented Aug 22, 2017

Upgraded an ASP.NET MVC Core 1.1.2 project under active development to 2.0 and got an error where one did not previously exist (no code has changed other than referenced libraries).

In Startup.cs / ConfigureServices(), when calling:

services.RegisterServices();

I now get the exception:

System.TypeLoadException occurred
HResult=0x80131522
Message=Method 'GetAsync' in type 'Microsoft.Extensions.Caching.Redis.RedisCache' from assembly 'Microsoft.Extensions.Caching.Redis, Version=1.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.

Is this just a matter of this package catching up? Or did something else fundamentally change that would cause this?

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Aug 22, 2017

It looks like you didn't properly update your dependencies. Either that or you have another dependency that relies on the 1.x version of caching that needs to be recompiled. What does your project file look like?

Loading

@DeveloperUniversity
Copy link
Author

@DeveloperUniversity DeveloperUniversity commented Aug 22, 2017

(Hey David, huge fan. :)

Project file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>
  <PropertyGroup>
    <PreserveCompilationContext>true</PreserveCompilationContext>
  </PropertyGroup>
  
  <PropertyGroup>
    <UserSecretsId>aspnet-BeastMuffin.Web-fb89c34e-fd62-43b7-a4c3-23a975580c1a</UserSecretsId>
    <ApplicationInsightsResourceId>/subscriptions/b94b3125-1f05-4a0a-9f2e-8e9b70eb5503/resourcegroups/BeastMuffinResourceGroup/providers/microsoft.insights/components/beastmuffin</ApplicationInsightsResourceId>
    <ApplicationInsightsAnnotationResourceId>/subscriptions/b94b3125-1f05-4a0a-9f2e-8e9b70eb5503/resourcegroups/BeastMuffinResourceGroup/providers/microsoft.insights/components/beastmuffin</ApplicationInsightsAnnotationResourceId>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="Areas\Manage\**" />
    <Content Remove="Areas\Manage\**" />
    <EmbeddedResource Remove="Areas\Manage\**" />
    <None Remove="Areas\Manage\**" />
  </ItemGroup>

  <ItemGroup>
    <Content Remove="Areas\Admin\Views\Downloads\Index.cshtml" />
    <Content Remove="Areas\Admin\Views\TransactionItems\Index.cshtml" />
  </ItemGroup>

  <ItemGroup>
    <None Remove="Properties\PublishProfiles\beastmuffin - FTP.pubxml" />
    <None Remove="Properties\PublishProfiles\BeastMuffin - Web Deploy.pubxml" />
  </ItemGroup>


  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.0.0" />
    <PackageReference Include="Microsoft.Azure.Search" Version="3.0.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.Extensions.Caching.Redis.Core" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
    <PackageReference Include="Sendgrid" Version="9.8.0" />
    <PackageReference Include="StackExchange.Redis" Version="1.2.6" />
    <PackageReference Include="Stripe.net" Version="10.4.0" />
    <PackageReference Include="WindowsAzure.Storage" Version="8.3.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Areas\Admin\Views\Achievements\" />
    <Folder Include="Areas\Admin\Views\Announcements\" />
    <Folder Include="Areas\Admin\Views\EnrollmentCriteria\" />
    <Folder Include="Areas\Admin\Views\EnrollmentCriteria\" />
    <Folder Include="Areas\Admin\Views\Menus\" />
    <Folder Include="Areas\Admin\Views\MenuItems\" />
    <Folder Include="Areas\Admin\Views\Tickets\" />
    <Folder Include="Areas\Admin\Views\Steps\" />
    <Folder Include="Properties\PublishProfiles\" />
    <Folder Include="Properties\PublishProfiles\" />
    <Folder Include="ViewModels\Payment\" />
    <Folder Include="Views\Shared\Components\Footer\" />
    <Folder Include="Views\Shared\Components\Navigation\" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\BeastMuffin.Model\BeastMuffin.Model.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System.Data.Entity">
      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.Entity.dll</HintPath>
    </Reference>
  </ItemGroup>
  
  <ItemGroup>
    <WCFMetadata Include="Connected Services" />
  </ItemGroup>

</Project>

Loading

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Aug 22, 2017

Any thing Microsoft.Extensions.* or Microsoft.AspNetCore.* or Microsoft.EntityFrameworkCore.* should be 2.0.0. It looks like you forgot to update:

  • Microsoft.Extensions.Caching.Redis.Core
  • Microsoft.EntityFrameworkCore.SqlServer.Design

Also, I'd recommend reading this document https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/. It explains how to properly migrate from ASP.NET Core 1.x to 2.x. You can get rid of most of those package references by using the new Microsoft.AspNetCore.All package

Loading

@DeveloperUniversity
Copy link
Author

@DeveloperUniversity DeveloperUniversity commented Aug 22, 2017

I admit I'm stumbling through this so I apologize if I'm just dense ... I don't think Microsoft.Extensions.Caching.Redis.Core has been released to NuGet (?) because ...

https://www.nuget.org/packages/Microsoft.Extensions.Caching.Redis.Core/

... only shows 1.0.3 available, and when I attempted to manually change the version number in my project file to 2.0.0, I get an error:

NU1102	Unable to find package Microsoft.Extensions.Caching.Redis.Core with version (>= 2.0.0)
  - Found 3 version(s) in nuget.org [ Nearest version: 1.0.3 ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in C:\Program Files\dotnet\sdk\NuGetFallbackFolder	BeastMuffin.Web	C:\Users\bob\Source\Repos\BeastMuffin\BeastMuffin.Web\BeastMuffin.Web.csproj	1	

(Same is true with Microsoft.EntityFrameworkCore.SqlServer.Design ... I see this error:

NU1102	Unable to find package Microsoft.EntityFrameworkCore.SqlServer.Design with version (>= 2.0.0)
  - Found 12 version(s) in nuget.org [ Nearest version: 2.0.0-preview1-final ]
  - Found 6 version(s) in Microsoft Visual Studio Offline Packages [ Nearest version: 1.1.2 ]
  - Found 0 version(s) in C:\Program Files\dotnet\sdk\NuGetFallbackFolder	BeastMuffin.Web	C:\Users\bob\Source\Repos\BeastMuffin\BeastMuffin.Web\BeastMuffin.Web.csproj	1	

Thanks for your help, btw!!!

Loading

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Aug 22, 2017

@DeveloperUniversity I would start by reading the article and removing the appropriate package references and replacing them with the .All package.

Loading

@Tratcher
Copy link
Member

@Tratcher Tratcher commented Aug 23, 2017

Microsoft.Extensions.Caching.Redis.Core wasn't an official package (look at the owner). Use Microsoft.Extensions.Caching.Redis instead. https://www.nuget.org/packages/Microsoft.Extensions.Caching.Redis/

Loading

@DeveloperUniversity
Copy link
Author

@DeveloperUniversity DeveloperUniversity commented Aug 23, 2017

This was resolved by following the instructions, pulling out ALL package reference sections and adding just a few back in one by one. Thank you.

Loading

@paulirwin
Copy link

@paulirwin paulirwin commented Feb 26, 2018

@Tratcher I was just bit by the same unofficial nuget package. The author when viewed in the NuGet manager in Visual Studio shows as "Microsoft.Extensions.Caching.Redis". I've reported that package to NuGet for the author fraudulently making it look like it's an official Microsoft package.

Loading

@CumpsD
Copy link

@CumpsD CumpsD commented Apr 17, 2018

Just got bit by this as well, thanks for the comments, helped me resolve it. Had the wrong .Core package too

Loading

@Rainy99
Copy link

@Rainy99 Rainy99 commented Jul 9, 2018

@Tratcher Thanks,It's very useful.

Loading

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

Successfully merging a pull request may close this issue.

None yet
6 participants