vrchat-community / UdonSharp

A compiler for compiling C# to Udon assembly
https://udonsharp.docs.vrchat.com
MIT License
470 stars 50 forks source link

Error in U# migration if parent prefab of prefab variant does not have U# Behaviour #104

Open anatawa12 opened 1 year ago

anatawa12 commented 1 year ago

Describe the bug in detail: Error if parent prefab of prefab variant does not have U# Behaviour.

Provide steps/code to reproduce the bug: import U# 0.x version (1.3.4) of https://booth.pm/ja/items/2683599

Expected behavior: No error

Additional Information: Due to another issue (#106), prefab will be completely broken.

anatawa12 commented 1 year ago
[UdonSharp] Exception while sorting prefabs for upgrade. Falling back to non-sorted set, nested prefabs may not upgrade properly. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at UdonSharpEditor.UdonSharpPrefabDAG..ctor (System.Collections.Generic.IEnumerable`1[T] allPrefabRoots) [0x000b8] in /Users/anatawa12/UnityProjects/UdonSharp/Packages/com.vrchat.UdonSharp/Editor/UdonSharpPrefabDAG.cs:45 
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [UdonSharpEditorUtility.cs:382] UdonSharpEditor.UdonSharpEditorUtility:UpgradePrefabs (System.Collections.Generic.IEnumerable`1<UnityEngine.GameObject>)
 #5  (Mono JIT Code) [UdonSharpEditorManager.cs:818] UdonSharpEditor.UdonSharpEditorManager:UpgradeAssetsIfNeeded ()
 #6  (Mono JIT Code) [UdonSharpEditorManager.cs:744] UdonSharpEditor.UdonSharpEditorManager:OnEditorUpdate ()
 #7  (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
 #8 mono_jit_runtime_invoke
 #9 do_runtime_invoke
 #10 mono_runtime_try_invoke_array
 #11 ves_icall_InternalInvoke
 #12  (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
 #13  (Mono JIT Code) System.Reflection.MethodBase:Invoke (object,object[])
 #14 mono_jit_runtime_invoke
 #15 do_runtime_invoke
 #16 mono_runtime_invoke
 #17 mono_runtime_invoke_profiled(MonoMethod*, ScriptingObjectPtr, void**, MonoException**, MonoClass*)
 #18 CallStaticMonoMethod(char const*, char const*, void**, ScriptingExceptionPtr*)
 #19 CallStaticMonoMethod(char const*, char const*, void**)
 #20 Application::TickTimer()
 #21 -[EditorApplication TickTimer]
 #22 __NSFireTimer
 #23 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
 #24 __CFRunLoopDoTimer
 #25 __CFRunLoopDoTimers
 #26 __CFRunLoopRun
 #27 CFRunLoopRunSpecific
 #28 RunCurrentEventLoopInMode
 #29 ReceiveNextEventCommon
 #30 _BlockUntilNextEventMatchingListInModeWithFilter
 #31 _DPSNextEvent
 #32 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
 #33 -[NSApplication run]
 #34 NSApplicationMain
 #35 EditorMain(int, char const**)
 #36 main
 #37 ???