Foq icon indicating copy to clipboard operation
Foq copied to clipboard

Foq error is very unhelpful for internal types

Open Frassle opened this issue 4 years ago • 0 comments

Description

When using an internal type in a mock Foq can crash with incredibly confusing System.MethodAccessException errors. This can be fixed by either making the type public or adding InternalsVisbleTo("Foq.Dynamic"). But this bug is not that an error occurs but that the error is unhelpful for working out what's actually wrong.

Repro steps

Please provide the steps required to reproduce the problem

  1. Add an internal type to an assembly

  2. Use that internal type as part of an Mock<_>

Expected behavior

Foq should crash with an error explict about the fact an internal type has been used that Foq can't see.

Actual behavior

Foq crashes with a MethodAccessException.

Known workarounds

Just know that MethodAccessException could mean a visibility issue.

Frassle avatar Jan 07 '21 10:01 Frassle

Hi!

Spaces are considered to be not equal to newline inside of html-tags...

<p>
Hello, Bob!
</p>

and

<p>Hello, Bob!</p>

are equal, but

<p>Hello, Bob!</p>

and

<p>Hello, 
Bob!</p>

are not!


If you need another behaviour, so you pull request some option, I think.

eGavr avatar Jan 30 '18 12:01 eGavr

Ah, now I see what went wrong there. Since you strip all newlines in ignoreWhitespace(), the following two paragraphs are equivalent:

<p>wrapped
paragraph</p>

<p>wrappedparagraph</p>
HtmlDiffer = require('html-differ').HtmlDiffer;
htmlDiffer = new HtmlDiffer();
first = '<p>wrapped\nparagraph</p>';
second = '<p>wrappedparagraph</p>';
console.log(htmlDiffer.isEqual(first, second));
> true

I think you should replace them with a space to adhere to the segment break transformation rules for non-pre white-space CSS styles. Multiple adjacent spaces are then collapsed to a single one in the next step, so the following two paragraphs will be equivalent, instead:

<p>wrapped
paragraph</p>

<p>wrapped paragraph</p>

which looks correct to me!

Feder1co5oave avatar Feb 02 '18 17:02 Feder1co5oave