API Updater not explicit at all

Hi everybody,

I have a simple question:

Is there a way to know what the API Updater has updated?

My scenario is simple, I am Asset Store developer, I do scripting.

Whenever I copy my files to test on Unity 2017.1.0f3, I receive no warning or error.

But if I compile my files into a library and copy the result in Unity 2017.1.0f3, API Updater is triggered.

Assembly: ‘C:/Unity/Test/Assets/Plugins/TestLibrary.dll’ uses obsolete Unity API (UnityUpgradable)

I checked the logs but no interesting data is given.

To isolate the guilty code, I would have to remove code and retry, but my libraries are bigger than 100kB and have dependencies.
It will take a very long day or many days to narrow it down for all my libraries.

Thank you people!

Edit:
Test 1:
I tried to build, to force Unity to tell me more data, nothing happened.

Test 2:
I manually copied the DLL into the project, in this case, Unity does not trigger the API Updater.
API Updater is only triggered when I import it via a package.

Test 3:
I ran this script:
“C:\Program Files\Unity 2017.1.0f3\Editor\Data\MonoBleedingEdge\bin\mono.exe” -v “C:/Program Files/Unity 2017.1.0f3/Editor/Data/Tools/ScriptUpdater/AssemblyUpdater.exe” --timestamp 636382412760996084 --api-version 2017.1.0f3 --check-update-required -a C:/Users/mikil/Documents/Unity/TestUA/Assets/Plugins/NGTools/Editor/NGRemoteSceneEditor.dll -s “C:\Program Files\Unity 2017.1.0f3\Editor\Data\Managed,+C:/Program Files/Unity 2017.1.0f3/Editor/Data\UnityExtensions/Unity,+C:/Users/mikil/Documents/Unity/TestUA/Assets” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Advertisements\UnityEngine.Advertisements.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Advertisements\Editor/UnityEditor.Advertisements.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\GUISystem\UnityEngine.UI.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\GUISystem\Standalone/UnityEngine.UI.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\GUISystem\Editor/UnityEditor.UI.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Networking\UnityEngine.Networking.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Networking\Standalone/UnityEngine.Networking.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Networking\Editor/UnityEditor.Networking.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\TestRunner\Editor/UnityEditor.TestRunner.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\TestRunner\UnityEngine.TestRunner.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\TestRunner\net35/unity-custom/nunit.framework.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\TestRunner\portable/nunit.framework.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Timeline\RuntimeEditor/UnityEngine.Timeline.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Timeline\Runtime/UnityEngine.Timeline.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\Timeline\Editor/UnityEditor.Timeline.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\TreeEditor\Editor/UnityEditor.TreeEditor.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityAnalytics\UnityEngine.Analytics.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityAnalytics\Editor/UnityEditor.Analytics.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityHoloLens\Editor/UnityEditor.HoloLens.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityHoloLens\Runtime/UnityEngine.HoloLens.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityHoloLens\RuntimeEditor/UnityEngine.HoloLens.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityPurchasing\UnityEngine.Purchasing.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityPurchasing\Editor/UnityEditor.Purchasing.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\UnityExtensions\Unity\UnityVR\Editor/UnityEditor.VR.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\Managed\UnityEngine.dll” “C:\Program Files\Unity 2017.1.0f3\Editor\Data\Managed\UnityEditor.dll” > result.txt
pause

To simplify, it runs API Updater on NGRemoteSceneEditor.dll.

The few first lines of result.txt:
converting method void System.OutOfMemoryException:.ctor (string)
Method void System.OutOfMemoryException:.ctor (string) emitted at 00690D78 to 00690DA6 (code length 46) [AssemblyUpdater.exe] with opts peephole,branch,inline,cfold,consprop,copyprop,deadce,linears,cmov,intrins,loop,fcmov,aot,exception,gshared,simd,unsafe,float32

It is converting OutOfMemoryException’s constructor… And the remaining lines are code not from my library.
At this point, I don’t even know if I can solve this API Updater.

Hi

Unfortunately there’s no easy way to figure out why the updater thinks something should be updated.

Improving the updater logging is certainly in our backlog but we don’t have a time frame.

The behavior you described, i.e, compiling your source inside Editor or even importing the assembly not triggering the updater, is not expected.

Are you sure you haven’t allowed the updater to run before importing the assembly or your source code? (in this case you’d not be asked again if you did not restart the editor or open another project)

If you ware willing to I’ll send you a version of the updater with more logging (probably on next Monday)

Best

Adriano

1 Like

Thanks for the answer, would be interesting yeah!

We experienced the same exact issue and @Vagaus was very helpful in tracking down the source of the problem.

For us, this experience was triggered by a change in the Unity API that converted a “member method” into an “extension method.” The key here is that such an API change would result in no script adjustments; it’s invisible to everyone except the compiler. When the code is compiled, however, the IL that is produced and stored in an assembly is going to be different because the same script is resolved to a different function/method. This is [probably] the reason that you’re seeing the API Updater trigger for the assembly but not the script.

In our case the culprit was the WWW.GetAudioClip method. In Unity 5.6 this was converted into the WWWAudioExtensions.GetAudioClip extension method. Everything worked great in script, but our assemblies would [correctly] trigger the API Updater (which would properly handle the conversion).

While @Vagaus works on the adjusted updater executable, I’d suggest looking over the API History for 2017.1__*__ and see if you can find any *Extension classes in the list that look suspicious. A quick “find” for “extension” on that page shows the following interesting classes:

I hope this is helpful!

[* I have found that this list is not 100% comprehensive, but it is a good place to start…]

2 Likes

@Mikilo @SonicBloomEric You can download a version of the updater with more logging enabled here https://drive.google.com/open?id=0B7GZ512tQYxkMGhmM0FjU1FDQms

You will need to set the log level to Info or Debug through UNITY_ASSEMBLYUPDATE_LOGTHRESHOLD environment variable.

You can either replace the folder Editor/Data/Tools/ScriptUpdater with the contents of the zip file (of course, back up your installation before doing that) or extract the zip file somewhere and run the updater in the command line (if you feel adventurous) (easiest way to do that is to force the udpater to run - inside the editor - which will log the command line arguments used in the Editor.log and then running this new version of the updater with the same set of parameters)

BTW, these changes will be incorporated in the shipped version in the near future.

Best

1 Like

I knew you were the man :slight_smile:

Thank for the update, I will give it a try later.

1 Like

@Mikilo @SonicBloomEric Have you had the chance to try it out ?

I am looking forward to hear your feedback

Best

Adriano

1 Like

Hey Vagaus!

Here is your first report:

[AssemblyUpdater] Time to start updater: 130 ms
[AssemblyUpdater] Time to check for API compatibility attribute: 26 ms

System.MissingMethodException: Method 'APIUpdater.Framework.Util.CecilExtensions.SymbolReaderProviderFor' not found.
  at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, APIUpdater.Framework.Configuration.IConfigurationProvider configuration, System.String[] assemblySearchPaths, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x0002b] in <fc8204afd8f44ddfb3725526ef3671e2>:0
  at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, System.String[] assemblySearchPaths, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x00001] in <fc8204afd8f44ddfb3725526ef3671e2>:0
  at AssemblyUpdater.Application.Program.CheckForObsoleteAPIUsage (AssemblyUpdater.Application.CommandLineSpec config) [0x00013] in <fc8204afd8f44ddfb3725526ef3671e2>:0
  at AssemblyUpdater.Application.Program.Main (System.String[] args) [0x00057] in <fc8204afd8f44ddfb3725526ef3671e2>:0
UnityEditor.Scripting.APIUpdaterHelper:smile:oesAssemblyRequireUpgrade(String)

In my case, I have a dozen DLLs, I reduced it to only 3 DLLs for the test.
Here are my steps:
1/ UNITY_ASSEMBLYUPDATE_LOGTHRESHOLD to “Debug”
2/ Replaced ScriptUpdater folder with your files.
3/ Launched empty project with Unity 2017.1.0f3.
4/ Imported a package containing 3 DLLs generated with Unity 5.4.0f3.

I think the exception above is aborting the whole process of updating the DLL.

I joined the ScriptUpdater output in this post.
If you want me to call ScriptUpdater.exe directly from the CLI, let me know.

3205421–245159–ScriptUpdaterLogs.txt (70.8 KB)

@Mikilo Thanks for the feedback

This is weird. This error means that the updater is using a method that is not present in the assemblies… which is pretty odd.

Can you create a simple project that reproduces the issue? If so, can you zip it and send me?

I’ll try to reproduce locally.

The strange things is, in your Zip, you have no AssemblyUpdater.exe, is that normal?

I’ll prepare you a zip.

Here is my project and stuff needed.

My ScriptUpdater folder: (4MB was too big apparently to be uploaded via this form)
https://ufile.io/9hq2e

3205465–245166–NGToolsDLL.rar (149 KB)
3209098–245666–NGT_DLL_TinyCore540.unitypackage (141 KB)

Definitely no :frowning:

I messed up.

I’ll prepare another zip with the correct content, sorry

Adriano

1 Like

Hi @Mikilo

I’ve just updated the ZIP contents. Can you give it another try and let me know the outcome?

Thanks

Adriano

Hi @Vagaus

I retried with your sample.
Unfortunately, I noticed no changes. Maybe you know where to look at.

Same configuration:
Unity 2017.1.0f3
Import package containing 3 DLLs generated with Unity 5.4.0f3.
UNITY_ASSEMBLYUPDATE_LOGTHRESHOLD still set with “Debug”.

Unity’s console is showing this:
(Each “-------------------------------------------” is to separate logs)

Assembly: ‘C:/Users/mikil/Documents/Unity/NGTools/NGTools 2017.1.0f3/Assets/Plugins/NGTools/NGCore/Editor/NGCoreEditor.dll’ uses obsolete Unity API (UnityUpgradable)

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.MissingMethodException: Method not found: ‘UnityEngine.Texture2D.LoadImage’.
at NGToolsEditor.Language_english..ctor () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[ ],System.Exception&)
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) [0x00119] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:513
— End of inner exception stack trace —
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) [0x0012c] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:519
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:528
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[ ] args, System.Globalization.CultureInfo culture, System.Object[ ] activationAttributes) [0x001b8] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:338
at System.Activator.CreateInstance (System.Type type, System.Object[ ] args, System.Object[ ] activationAttributes) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:268
at System.Activator.CreateInstance (System.Type type, System.Object[ ] args) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:263
at NGToolsEditor.Utility.CreateAllInstancesOf[EmbedLocale] (System.Object[ ] args) [0x00000] in :0
at NGToolsEditor.Localization..cctor () [0x00000] in :0
UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes()

Finished updating scripts / assemblies

MissingMethodException: Method not found: ‘UnityEngine.Texture2D.LoadImage’.
UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:118)

You will find the full log attached to this post.

I also tried to run the command manually, I add the argument “-v” in the command.
You will find the result attached as well. (result.txt)

3208362–245578–Editor.txt (26.9 KB)
3208362–245580–result.txt (619 KB)

Hi

Can you share this package with me? So I can look into it.

Best

Adriano

It is this one. I uploaded it in the post above.

3209098–245666–NGT_DLL_TinyCore540.unitypackage (141 KB)

@Mikilo What are your .NET API settings? Are you using 4.6 or the default settings?

@Vagaus Sorry for the radio silence - I didn’t get any notifications of posts here! I will update the forum settings so that I get emails. I’ll try to find some time this week to give the build a shot.

@SonicBloomEric I use the default settings.

1 Like

I am not sure what is going on on your side :frowning:

Attached you can see the output of the AssemblyUpdater with the latest version I’ve pushed to Google Drive, which means it runs and does log the updates. (notice that the log only happens when we update the assembly, which not happens if you pass –check-update-required argument to AssemblyUpdater)

Can you share more details?

  • Full command line used
  • OS
  • Version of .NET / Mono

Adriano

3209403--245683--AssemblyUpdater.png

No problems at all :wink:

Thanks for helping improve the updater

Best

Adriano

1 Like