Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't ignore non-public interfaces unconditionally #641

Merged
merged 2 commits into from
Jul 13, 2018

Commits on Jul 13, 2018

  1. Don't ignore non-public interfaces unconditionally

    When mocking a type, Moq currently disregards all its base interfaces
    that are declared non-public. This was implemented in 6ad7103 to
    prevent DynamicProxy from choking on types inaccessible to it.
    
    This produces some collateral damage concerning `CallBase`: even when
    `CallBase == true` on the mock, base methods will not be called if
    they are declared in a non-public base interface.
    
    Simply excluding non-public base interfaces is too imprecise, because
    if there is a suitable `[assembly: InternalsVisibleTo]` custom attri-
    bute for DynamicProxy, then even a non-public interface might be
    accessible to DynamicProxy, and the error which the type exclusion
    supposedly protects against wouldn't occur in the first place.
    
    So instead of just excluding a non-public base interface, let's simply
    *ask* DynamicProxy whether it can access it or not.
    stakx committed Jul 13, 2018
    Configuration menu
    Copy the full SHA
    b48bb2b View commit details
    Browse the repository at this point in the history
  2. Update the changelog

    stakx committed Jul 13, 2018
    Configuration menu
    Copy the full SHA
    420d9e7 View commit details
    Browse the repository at this point in the history