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

unwarranted "Co-variant array conversion from Transform[] to Object[]" warning #2437

Open
benblo opened this issue Mar 26, 2024 · 1 comment

Comments

@benblo
Copy link

benblo commented Mar 26, 2024

We get a "Co-variant array conversion from Transform[] to Object[] can cause run-time exception on write operation" warning when using eg Undo.RecordObjects(transforms, "Edit Transforms"); (passing a Transform[] when the method signature only takes Object[]).

I understand why this happens, but in this case it's unwarranted because the array we pass will only be read, not written to. I'm sure there are more such examples in the Unity API.

  • Is there a mechanism in Resharper to white-list methods for warnings? external annotations?
  • If so, is there such a Unity-specific whitelist we can edit somewhere / send a PR?
@akaSurreal
Copy link

I also ran into this today regarding

SpriteAtlasExtensions.Add

When adding a Sprite[] array. It would be nice if Rider/Resharper was intelligent enough to know this is expected behavior and not create a warning.

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

2 participants