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
    untriaged
    on Jul 17, 2026
  2. added
    area-CodeGen-coreclr
    on Jul 17, 2026
  3. 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.

  4. added
    area-Tools-ILVerification
    and removed
    area-CodeGen-coreclr
    on Jul 17, 2026
  5. 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.

  6. added this to the 12.0.0 milestone on Jul 17, 2026
  7. removed
    untriaged
    on Jul 17, 2026
  8. added 2 commits that reference this issue on Oct 18, 2026
    d98630f
    d156add
  9. added a commit that references this issue on Oct 20, 2026
    eee5433
  10. locked and limited conversation to collaborators on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-Tools-ILVerification

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions