Embedded JetBrains.Annotations in (v5) UnityEngine.dll

We use ReSharper with our project, and have previously included a copy of JetBrains.Annotations. See http://answers.unity3d.com/questions/625936/vs-2013-w-resharper-start-update-ongui-is-never-us.html for more info.

After upgrading the project to Unity 5, I discovered that UnityEngine.dll has its own copy of the JetBrains.Annotations namespace embedded inside it. Does anyone know if this is intentional and will it be included in all future versions of Unity?

If so, I'll remove our copy from the project.

This is intentional, yes, and you can rely on the attributes being included in all future versions of Unity. I embedded them directly for a few reasons:

  • Save users the trouble of adding references to the DLL and copying files around.
  • Remove non-applicable or obsolete attributes to reduce Intellisense noise.
  • Enable easy use for Unity engineers on internal code. (Some of these might eventually show up attached to public API's if it makes sense.)

I used the "Copy default implementation to clipboard" to get the source, and removed Asp*, Html*, and Razor* (not needed in the land of Unity), plus some redundant and obsolete attributes. Then I added missing attributes found in the JetBrains.Annotations.xml in the ReSharper install folder. I'm not sure why JetBrains has different attributes in their default implementation vs embedded in their DLL.

As new versions of R# come out I'll keep these up to date. Ping me if I mess anything up for you. :)


This is extremely informative. Thanks very much for the update and for including these annotations in Unity!