Skip to content

Foq error is very unhelpful for internal types #32

@Frassle

Description

@Frassle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions