I’m running into this as well. It appears to have broken our ability to run Edit Mode unit tests in the Test Runner, because hitting Run All will cause the asset database to refresh and print this error, which Test Runner interprets as an exception and cancels the tests.
Here are some example stacks from our editor logs:
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
UnityEditor.AssetDatabase:SaveAssets()
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
UnityEditor.AssetDatabase:Refresh(ImportAssetOptions)
UnityEditor.AssetDatabase:Refresh()
Packages.Rider.Editor.RiderScriptEditor:SyncAll() (at Library\PackageCache\com.unity.ide.rider@1.1.4\Rider\Editor\RiderScriptEditor.cs:235)
UnityEditor.CodeEditorProjectSync:SyncEditorProject()
UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroupInternal(BuildTargetGroup, String)
UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
(Filename: C:\buildslave\unity\build\Modules/AssetDatabase/Editor/V2/V1Compatibility.cpp Line: 2841)
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
UnityEditor.AssetDatabase:CreateFolder(String, String)
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
UnityEditor.AssetDatabase:CreateAsset(Object, String)
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
UnityEditor.AssetDatabase:smile:eleteAsset(String)
Assertion failed on expression: 'gOnDemandAssets->empty() || GetOnDemandModeV2() != AssetDatabase::OnDemandMode::Off'
UnityEditor.AssetDatabase:StopAssetEditing()
UnityEditor.ProjectWindowUtil:smile:eleteAssets(List`1, Boolean)
UnityEditor.ProjectBrowser:smile:eleteSelectedAssets(Boolean)
UnityEditor.ProjectBrowser:HandleCommandEventsForTreeView()
UnityEditor.ProjectBrowser:OnGUI()
As you can see, it seems to get triggered whenever the asset database does… basically anything.
Edit: By printing out
UnityEditor.Experimental.AssetDatabaseExperimental.ActiveOnDemandMode, I have confirmed that the active mode is indeed Off.
This value is settable, and setting it to either Background or Lazy does seem to make the error go away. I’m unsure which one I should set it to, though, and whether those changes will get checked in anywhere or if I will have to write a tool that constantly sets them whenever someone opens the project.