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
Add an internal type to an assembly
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.
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
Add an internal type to an assembly
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.