Skip to content
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

Method 'GetReferrers' in type 'Sitecore.FakeDb.Links.FakeLinkDatabase' does not have an implementation #218

Open
LukasDvorak opened this issue Oct 27, 2020 · 2 comments

Comments

@LukasDvorak
Copy link

Hi,

I am trying to run unit tests and I got stuck here

using (var db = new Db()) { }

throws

Message: 
    System.TypeLoadException : Method 'GetReferrers' in type 'Sitecore.FakeDb.Links.FakeLinkDatabase' from assembly 'Sitecore.FakeDb, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
  Stack Trace: 
    RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
    RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
    RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
    Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
    DefaultFactory.CreateType(XmlNode configNode, String[] parameters, Boolean assert)
    DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
    DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
    DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
    DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
    DefaultFactory.CreateObject(String configPath, Boolean assert)
    DefaultFactory.GetLinkDatabase()
    Globals.Load()
    (Object , Object[] )
    PipelineMethod.Invoke(Object[] parameters)
    CorePipeline.Run(PipelineArgs args)
    DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
    DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
    DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args)
    Db.ctor(String databaseName)

I used these configurations

https://github.com/sshushliapin/Sitecore.FakeDb/blob/master/test/Sitecore.FakeDb.Tests/App.config (but with different <runtime> section)
https://github.com/sshushliapin/Sitecore.FakeDb/blob/master/src/Sitecore.FakeDb/Sitecore.config

Sitecore version: Sitecore 8.2 Update-6
Test project is running under .NETFramework 4.7.1.

@sshushliapin
Copy link
Owner

Hi @LukasDvorak, I run the entire (1k+) unit tests against 8.2.6 and .net471... I can see no issues with the FakeLinkDatabase and GetReferrers... Is there any chance to provide a more precise scenario to reproduce?

@devshima
Copy link

devshima commented Feb 18, 2022

I got the same error in these configurations.

Sitecore FakeDb: 2.0.1
Sitecore version: Sitecore 8.2 Update-7
Test project is running under .NETFramework 4.7.1

My solution was to use Sitecore FakeDb: 1.7.4 (net461).
And add Reference

Microsoft.Extensions.DependencyInjection 1.0.2
Microsoft.Extensions.DependencyInjection.Abstractions 1.0.2

Sitecore FakeDb: 2.0.1 = .NET Framework 4.7.1 and later
Sitecore FakeDb: 1.7.4 = .NET Framework 4.5.0 and later
Sitecore 8.2.x = .NET Framework 4.6.1

I think we need to match .NET Framework versions of FakeDb And Sitecore .

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

No branches or pull requests

3 participants