When is called AssetPostprocessingInternal.CleanupPostprocessors()

Does anyone know when AssetPostprocessingInternal.CleanupPostprocessors() is called?
We have currently an ArgumentOutOfRangeException on a ArrayList.RemoveAt() where the “index” parameter is -1.

We have about 10 derived classes of AssetPostprocessor. By commenting out the implementation the OnPostprocessAllAssets() of one of them, it solves the problem. But assuming it’s important, I wanto know why is there a crash. In the implementation, there are operations like AssetDatabase.DeleteAsset() and AssetDatabase.CreateAsset() of the same asset file. I isolated these operations in a small project but it doesn’t trigger any exception.

Thanks in advance

In unity4.7, the “InitPostprocessors” was called when asset import start and “CleanupPostprocessors” was called when asset import end. They should always be called by pair. The “CleanupPostprocessors” will have ArgumentOutOfRangeException crash if the function was called more than “InitPostprocessors” was called.

The “OnPostprocessAllAssets” function was called between start and end of asset import. In your case, it modified AssetDatabase which may trigger another Asset Import. This could break the “InitPostprocessors” and “CleanupPostprocessors” pair.