## Why is this an issue?

Altering or bypassing the accessibility of classes, methods, or fields through reflection violates the encapsulation principle. This can break the internal contracts of the accessed target and lead to maintainability issues and runtime errors.

This rule raises an issue when reflection is used to change the visibility of a class, method or field, and when it is used to directly update a field value.

    Imports System.Reflection

    Dim dynClass = Type.GetType("MyInternalClass")
    ' Sensitive. Using BindingFlags.NonPublic will return non-public members
    Dim bindingAttr As BindingFlags = BindingFlags.NonPublic Or BindingFlags.Static
    Dim dynMethod As MethodInfo = dynClass.GetMethod("mymethod", bindingAttr)
    Dim result = dynMethod.Invoke(dynClass, Nothing)

## Resources

### Documentation

- Wikipedia definition of Encapsulation