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

AccessPublicizedMemberAnalyzer threw an exception of type 'System.IndexOutOfRangeException' #7

Open
myocytebd opened this issue Oct 13, 2022 · 0 comments

Comments

@myocytebd
Copy link

myocytebd commented Oct 13, 2022

BepinEx 5.4.21.0

All of a sudden, AccessPublicizedMemberAnalyzer starts to throw this exception:

Warning AD0001: Analyzer 'BepInEx.Analyzers.AccessPublicizedMemberAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'. (AD0001)

After some bisecting, I think it is due to this code. (Not verified in a standalone project)

// [assembly: IgnoresAccessChecksTo("UnityEngine")] is in another file.
// UnityEngine.ResourceRequest.asset getter
[HarmonyPrefix, HarmonyPatch(typeof(ResourceRequest), nameof(ResourceRequest.asset), MethodType.Getter)]
public static bool ResourceRequest_get_asset(out UnityEngine.Object __result, ResourceRequest __instance) {
    __result = Resources.Load(__instance.m_Path, __instance.m_Type);  // AccessPublicizedMemberAnalyzer dislike this line
    return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant