我有一个WPF应用程序,我在不同的线程中运行一些动画,这样我的主UI线程就会响应。我正在使用这里发布的代码:
通常情况下它都能正常工作,但是在系统部署后,我收到了一个应用崩溃的投诉,并附上以下堆栈跟踪信息:
Thread thread = new Thread(() =>
{
Window1 w = new Window1();
w.Show();
w.Closed += (sender2, e2) => w.Dispatcher.InvokeShutdown();
System.Windows.Threading.Dispatcher.Run();
});
thread.IsBackground = true;
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
通常情况下它都能正常工作,但是在系统部署后,我收到了一个应用崩溃的投诉,并附上以下堆栈跟踪信息:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.List`1.RemoveAt(Int32 index)
at System.IO.Packaging.PackagePart.CleanUpRequestedStreamsList()
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream()
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Window1.xaml:line 1
at Window1..ctor()
有人看到过这个异常吗?能解释一下发生了什么吗?这个特定异常的原因是什么?
我正在使用 .Net 3.5 SP1