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

Incorrect NotNullAttribute on UnityEngine.Component.transform #2455

Open
ymfact opened this issue Jul 29, 2024 · 0 comments
Open

Incorrect NotNullAttribute on UnityEngine.Component.transform #2455

ymfact opened this issue Jul 29, 2024 · 0 comments

Comments

@ymfact
Copy link

ymfact commented Jul 29, 2024

There is an issue with the incorrect usage of NotNullAttribute in the UnityEngine.Component.transform property.

In the file resharper-unity/resharper/resharper-unity/src/annotations/UnityEngine.xml, the following entry is present:

<member name="P:UnityEngine.Component.transform">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
</member>

This annotation is incorrect because the transform property can indeed be null in certain scenarios. For example, when the GameObject to which the MonoBehaviour is attached is destroyed, but a lambda capturing this remains, the transform property will return null.

As such, using NotNullAttribute is inappropriate and misleading in this context. To accurately reflect the behavior of the transform property, the NotNullAttribute should be removed.

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