辅助功能
Closed this issue · 1 comments
System.Reflection.TargetInvocationException: An error occurred while dispatching a call to the UI Thread ---> System.NullReferenceException: 未将对象引用设置到对象的实例。
在 Stylet.BindableCollection`1.<>c__DisplayClass9_0.b__0() 位置 C:\projects\stylet\Stylet\BindableCollection.cs:行号 115
在 Stylet.Execute.<>c__DisplayClass13_0.b__0() 位置 C:\projects\stylet\Stylet\Execute.cs:行号 95
--- 内部异常堆栈跟踪的结尾 ---
在 Stylet.Execute.OnUIThreadSync(Action action) 位置 C:\projects\stylet\Stylet\Execute.cs:行号 104
在 GBCLV3.ViewModels.ResourcePackViewModel.b__15_0()
在 System.Threading.Tasks.Task.Execute()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 GBCLV3.ViewModels.ResourcePackViewModel.d__15.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
[Launcher Version: 3.0.1.27]
Hi, it turns out that if the "recourcepacks" dir doesn't exist, the RecourcepackService::LoadAll()
will return null
, thus causes NullReferenceException
when adding to a BindableCollection
. Now that every time the RecourcepackService::LoadAll()
is called, the "recourcepacks" dir is created, so it will always return IEnumerable<ResourcePack>
(even if it's empty)
(。・∀・)ノ゙嗨,bug的原因是由于当资源包文件夹不存在时,RecourcepackService::LoadAll()
会返回 null
,从而在添加进 BindableCollection
时导致空引用异常。现在加载时直接创建 " recourcepacks " 文件夹,这样无论如何都会返回 IEnumerable<ResourcePack>
(即使为空),便不会导致异常了。