Skip to content

String with asset GUID's prevents dependency index rebuild #53

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

Open
CRG-Hans opened this issue Jan 7, 2025 · 0 comments
Open

String with asset GUID's prevents dependency index rebuild #53

CRG-Hans opened this issue Jan 7, 2025 · 0 comments

Comments

@CRG-Hans
Copy link

CRG-Hans commented Jan 7, 2025

If you reference a asset using its asset GUID in code (with dashes), retrieved via AssetDatabase.AssetPathToGUID, the dependency index rebuild will fail.

Example if you have a asset with the GUID 1329489f-fc68-a574-78aa-f964e2a8bbd9 and you store that value as a string in a .cs file (with the dashes!).
The following exception is thrown, preventing the dependency index to build.

KeyNotFoundException: The given key '1329489f-fc68-a574-78aa-f964e2a8bbd9' was not present in the dictionary.
System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].ThrowKeyNotFoundException (System.Object key) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].get_Item (TKey key) (at <51fded79cd284d4d911c5949aff4cb21>:0)
UnityEditor.Search.DependencyIndexer.ProcessText (System.String& path, System.String& assetGuid) (at ./Library/PackageCache/com.unity.search.extensions@892b9ab4cf/Dependencies/DependencyIndexer.cs:320)
UnityEditor.Search.DependencyIndexer.ProcessAsset (System.String metaFilePath, System.Int32 progressId, System.Int32& completed, System.Int32 totalCount) (at ./Library/PackageCache/com.unity.search.extensions@892b9ab4cf/Dependencies/DependencyIndexer.cs:254)
UnityEditor.Search.DependencyIndexer+<>c__DisplayClass13_0.<Build>b__0 (System.String mf) (at ./Library/PackageCache/com.unity.search.extensions@892b9ab4cf/Dependencies/DependencyIndexer.cs:62)
System.Threading.Tasks.Parallel+<>c__DisplayClass32_0`2[TSource,TLocal].<ForEachWorker>b__0 (System.Int32 i) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`1[TLocal].<ForWorker>b__1 (System.Threading.Tasks.RangeWorker& currentWorker, System.Int32 timeout, System.Boolean& replicationDelegateYieldedBeforeCompletion) (at <51fded79cd284d4d911c5949aff4cb21>:0)
--- End of stack trace from previous location where exception was thrown ---
System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`1[TLocal].<ForWorker>b__1 (System.Threading.Tasks.RangeWorker& currentWorker, System.Int32 timeout, System.Boolean& replicationDelegateYieldedBeforeCompletion) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.TaskReplicator+Replica`1[TState].ExecuteAction (System.Boolean& yieldedBeforeCompletion) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.TaskReplicator+Replica.Execute () (at <51fded79cd284d4d911c5949aff4cb21>:0)
Rethrow as AggregateException: One or more errors occurred. (The given key '1329489f-fc68-a574-78aa-f964e2a8bbd9' was not present in the dictionary.)
System.Threading.Tasks.TaskReplicator.Run[TState] (System.Threading.Tasks.TaskReplicator+ReplicatableUserAction`1[TState] action, System.Threading.Tasks.ParallelOptions options, System.Boolean stopOnFirstFailure) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.Parallel.ForWorker[TLocal] (System.Int32 fromInclusive, System.Int32 toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1[T] body, System.Action`2[T1,T2] bodyWithState, System.Func`4[T1,T2,T3,TResult] bodyWithLocal, System.Func`1[TResult] localInit, System.Action`1[T] localFinally) (at <51fded79cd284d4d911c5949aff4cb21>:0)
--- End of stack trace from previous location where exception was thrown ---
System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException (System.Collections.ICollection exceptions, System.Threading.CancellationToken cancelToken, System.Exception otherException) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.Parallel.ForWorker[TLocal] (System.Int32 fromInclusive, System.Int32 toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1[T] body, System.Action`2[T1,T2] bodyWithState, System.Func`4[T1,T2,T3,TResult] bodyWithLocal, System.Func`1[TResult] localInit, System.Action`1[T] localFinally) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal] (TSource[] array, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1[T] body, System.Action`2[T1,T2] bodyWithState, System.Action`3[T1,T2,T3] bodyWithStateAndIndex, System.Func`4[T1,T2,T3,TResult] bodyWithStateAndLocal, System.Func`5[T1,T2,T3,T4,TResult] bodyWithEverything, System.Func`1[TResult] localInit, System.Action`1[T] localFinally) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal] (System.Collections.Generic.IEnumerable`1[T] source, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1[T] body, System.Action`2[T1,T2] bodyWithState, System.Action`3[T1,T2,T3] bodyWithStateAndIndex, System.Func`4[T1,T2,T3,TResult] bodyWithStateAndLocal, System.Func`5[T1,T2,T3,T4,TResult] bodyWithEverything, System.Func`1[TResult] localInit, System.Action`1[T] localFinally) (at <51fded79cd284d4d911c5949aff4cb21>:0)
System.Threading.Tasks.Parallel.ForEach[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Action`1[T] body) (at <51fded79cd284d4d911c5949aff4cb21>:0)
UnityEditor.Search.DependencyIndexer.Build (System.Int32 progressId, System.String[]& metaFiles) (at ./Library/PackageCache/com.unity.search.extensions@892b9ab4cf/Dependencies/DependencyIndexer.cs:62)
UnityEditor.Search.Dependency.RunThreadIndexing (UnityEditor.Search.DependencyIndexer index) (at ./Library/PackageCache/com.unity.search.extensions@892b9ab4cf/Dependencies/Dependency.cs:350)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()
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