Skip to content

ilverify doesn't respect IgnoreAccessChecksTo #130959

Closed

Description

@MichalPetryka

private static bool CanAccessMember(this MetadataType currentType, TypeDesc targetType, MethodAttributes memberVisibility, TypeDesc instance)
{
if (instance == null)
instance = currentType;
// Check access to class defining member
if (!currentType.CanAccess(targetType))
return false;
var targetTypeDef = (MetadataType)targetType.GetTypeDefinition();
if (memberVisibility == MethodAttributes.Public)
return true;
// This is module-scope checking, to support C++ file & function statics.
if (memberVisibility == MethodAttributes.PrivateScope)
return currentType.Module == targetTypeDef.Module;
if (memberVisibility == MethodAttributes.Assembly)
return currentType.Module == targetTypeDef.Module || targetTypeDef.Module.GrantsFriendAccessTo(currentType.Module);
if (memberVisibility == MethodAttributes.FamANDAssem)
{
if (currentType.Module != targetTypeDef.Module && !targetTypeDef.Module.GrantsFriendAccessTo(currentType.Module))
return false;
}

ilverify currently only respects InternalsVisibleToAttribute, it should also handle and return true for IgnoreAccessChecksTo.

@jkotas could you get copilot on this if you have no objections?

Activity

  1. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Jul 17, 2026
  2. dotnet-policy-service commented on Jul 17, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  3. added
    area-Tools-ILVerificationIssues related to ilverify tool and IL verification in general
    and removed
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Jul 17, 2026
  4. dotnet-policy-service commented on Jul 17, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
    See info in area-owners.md if you want to be subscribed.

  5. added this to the 12.0.0 milestone on Jul 17, 2026
  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 17, 2026
  7. added 2 commits that reference this issue on Oct 18, 2026
    d98630f
    d156add
  8. added a commit that references this issue on Oct 20, 2026
    eee5433
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-Tools-ILVerificationIssues related to ilverify tool and IL verification in general

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions