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.

Allow Faking of non-generic types with methods that have in parameters

See original GitHub issue

As mentioned in #1337, and due to castleproject/Core#339, types containing a method with an in parameter cannot be faked by FakeItEasy .NET Standard, and if the type is a generic type, it cannot be faked by either the FakeItEasy .NET Standard or .NET Framework editions.

Once Castle.Core supports these scenarios, we should do so as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
blairconradcommented, Jul 4, 2018

Yes, thanks @zvirja. And @thomaslevesque for verifying. I’d meant to look last night, but we’re expecting houseguests, and the vacuuming sucked up (ha!) all my time.

0reactions
thomaslevesquecommented, Jul 4, 2018

@zvirja I just checked. Faking delegates with in parameters works, but the read-only semantics is not honored, e.g. this will print 123:

delegate void Foo(in int x);
...
var foo = A.Fake<Foo>();
A.CallTo(() => foo(A<int>.Ignored)).AssignsOutAndRefParameters(123);
int z = 0;
foo(z);
Console.WriteLine(z);

Thanks for bringing this to our attention. I’ll open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing generic type to non generic methods
I guess this has to do with value being of generic type instead of specific. Is there any way to give generic types...
Read more >
Allow Faking of generic types with methods that have in ...
As mentioned in #1337 and castleproject/Core#339, generic types containing a method with an in parameter cannot be faked by FakeItEasy.
Read more >
What to do, if I need non generic class use generic inside ...
What to do, if I need non generic class use generic inside, but don't want pass down type arguments ... Let's assume we...
Read more >
4. Generics - Programming C# 5.0 [Book]
A generic type (or method) is allowed to use only features that it has specified through constraints, or that are defined by the...
Read more >
CA1004: Generic methods should provide type parameter
The following example shows the syntax for calling two generic methods. The type argument for InferredTypeArgument is inferred, and the type ...
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