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.

Faked delegates with in parameters don't honor the read-only semantics

See original GitHub issue

Reported by @zvirja https://github.com/FakeItEasy/FakeItEasy/issues/1338#issuecomment-402251902

Faked delegates with in parameters don’t honor the read-only semantics of in, i.e. it’s possible to configure the faked delegate to mutate the parameter:

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); // Should print 0, but prints 123

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
zvirjacommented, Jul 6, 2018

@blairconrad Thanks for mentioning, was happy to help ☺️

0reactions
blairconradcommented, Jul 6, 2018

This change has been released as part of FakeItEasy 4.7.1.

Thanks for your help, @zvirja! Look for your name in the release notes. 🏆

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow Faking of non-generic types with methods that have in ...
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);...
Read more >
Delegate does not take 9 arguments (FakeItEasy / C# 9.0)
Since you're passing a delegate with 9 parameters, it doesn't match any of the overloads. The compiler assumes (incorrectly) that you're trying ...
Read more >
@babel/plugin-proposal-throw-expressions | ...
Intro. Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain...
Read more >
smb.conf(5)
This parameter allows Samba to also permit delegation of the control over a point in ... Default: delete readonly = no delete share...
Read more >
NFS best practice and implementation guide | TR-4067
This document provides basic concepts, support information, configuration tips, and best practices for NFS in NetApp® ONTAP®. This guide covers the latest ...
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