question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MissingMethodException - Cannot create an instance of an interface when calling A.Fake<ITest> when debugging

See original GitHub issue

when I debug MSUnit test code I get

System.MissingMethodException occurred
  Message=Cannot create an instance of an interface.
  Source=mscorlib
  StackTrace:
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
  InnerException: 

on the first A.Fake<ITest>() call

ITest tt = A.Fake<ITest>();

It runs normally when I just run tests. so it happens only under visual studio debugger. what is is missing?

windows7/VS2010 ultimate/FakeItEasy 1.7.4626.65 Started recently… not sure what changed.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:51 (34 by maintainers)

github_iconTop GitHub Comments

2reactions
adamralphcommented, Feb 17, 2016

Is this not a case of having “Break when an exception is thrown” checked?

0reactions
thomaslevesquecommented, Feb 17, 2016

That, and Just My Code disabled

Read more comments on GitHub >

github_iconTop Results From Across the Web

MissingMethodException [Cannot create an instance of an ...
Really the explanation is in the message i.e. it can't create an instance of the interface, as you've said the constructor is cool, ......
Read more >
ASP.NET MVC – Cannot create an instance of an interface
I came across an error message recently that I hadn't seen before: The error occurred when I tried submitting the following form: The...
Read more >
Cannot create an instance of an interface while creating .net ...
Re: System. MissingMethodException: Cannot create an instance of an interface while creating . net object.
Read more >
Cannot create an instance of an interface - question
Hi, Just added HangFire to my MVC project. I have a Service Layer which has an interface and then the implementation.
Read more >
Debug C# interface implemenation located in nuget package
I have 4 projects: Project FarmCLI is the main project (.NET Core web application) Project Animal is a class library in a NuGet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found