System.Windows.Media.Animation.AnimationException:无法为'System.Windows.Shapes.Rectangle'上的'Margin'属性设置动画

时间:2011-03-30 02:47:09

标签: wpf

我有一个使用ShowDialog()从Thread调用的窗口; 有时我得到这个例外:

有没有人看到这个错误?

System.Windows.Media.Animation.AnimationException: Cannot animate the 'Margin' property on a 'System.Windows.Shapes.Rectangle' using a 'System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames'. For details see the inner exception.
---> System.Threading.ThreadAbortException: Thread was being aborted.
   at System.Windows.ContextLayoutManager.LayoutQueue.Add(UIElement e)
   at System.Windows.UIElement.InvalidateMeasure()
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.Media.Animation.AnimationStorage.OnCurrentTimeInvalidated(Object sender, EventArgs args)
   --- End of inner exception stack trace ---
   at System.Windows.Media.Animation.AnimationStorage.OnCurrentTimeInvalidated(Object sender, EventArgs args)
   at System.Windows.Media.Animation.Clock.FireEvent(EventPrivateKey key)
   at System.Windows.Media.Animation.Clock.RaiseAccumulatedEvents()
   at System.Windows.Media.Animation.TimeManager.RaiseEnqueuedEvents()
   at System.Windows.Media.Animation.TimeManager.Tick()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at System.Windows.Window.ShowDialog()
   at Sistema.WPFUtil.WindowProgress.<>c__DisplayClass1.<Show>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

-----------------------

PresentationHost.exe v3.0.6920.4902 built by: NetFXw7 - C:\Windows\System32\PresentationHost.exe
ntdll.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\SYSTEM32\ntdll.dll
kernel32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\kernel32.dll
KERNELBASE.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\KERNELBASE.dll
ADVAPI32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\ADVAPI32.dll
msvcrt.dll v7.0.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\msvcrt.dll
sechost.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\SYSTEM32\sechost.dll
RPCRT4.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\RPCRT4.dll
USER32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\USER32.dll
GDI32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\GDI32.dll
LPK.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\LPK.dll
USP10.dll v1.0626.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\USP10.dll
ole32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\ole32.dll
OLEAUT32.dll v6.1.7600.16567 - C:\Windows\system32\OLEAUT32.dll
mscoree.dll v4.0.31106.0 (Main.031106-0000) - C:\Windows\System32\mscoree.dll
SHLWAPI.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\SHLWAPI.dll
WININET.dll v8.00.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\WININET.dll
Normaliz.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\Normaliz.dll
urlmon.dll v8.00.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\urlmon.dll
CRYPT32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\CRYPT32.dll
MSASN1.dll v6.1.7600.16415 (win7_gdr.090828-1615) - C:\Windows\system32\MSASN1.dll
iertutil.dll v8.00.7600.16700 (win7_gdr.101103-1650) - C:\Windows\system32\iertutil.dll
SHELL32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\SHELL32.dll
IMM32.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\IMM32.DLL
MSCTF.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\MSCTF.dll
PSAPI.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\PSAPI.DLL
PresentationHost_v0400.dll v4.0.30319.1 built by: RTMRel - C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationHost_v0400.dll
MSVCR100_CLR0400.dll v10.00.30319.1 - C:\Windows\System32\MSVCR100_CLR0400.dll
VERSION.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\VERSION.dll
CRYPTBASE.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\CRYPTBASE.dll
uxtheme.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\uxtheme.dll
CLBCatQ.DLL v2001.12.8530.16385 (win7_rtm.090713-1255) - C:\Windows\system32\CLBCatQ.DLL
CRYPTSP.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\CRYPTSP.dll
rsaenh.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\rsaenh.dll
RpcRtRemote.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\RpcRtRemote.dll
ntmarta.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\ntmarta.dll
WLDAP32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\WLDAP32.dll
SspiCli.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\SspiCli.dll
profapi.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\profapi.dll
dwmapi.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\dwmapi.dll
comctl32.dll v6.10 (win7_rtm.090713-1255) - C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16661_none_420fe3fa2b8113bd\comctl32.dll
ws2_32.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\ws2_32.DLL
NSI.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\NSI.dll
dnsapi.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\dnsapi.DLL
iphlpapi.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\iphlpapi.DLL
WINNSI.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\WINNSI.DLL
RASAPI32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\RASAPI32.dll
rasman.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\rasman.dll
rtutils.dll v6.1.7600.16617 (win7_gdr.100618-1621) - C:\Windows\System32\rtutils.dll
mswsock.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\mswsock.dll
wshtcpip.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\wshtcpip.dll
NLAapi.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\NLAapi.dll
rasadhlp.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\rasadhlp.dll
wship6.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\wship6.dll
WLIDNSP.DLL v7.250.4225.0 - C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
fwpuclnt.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\fwpuclnt.dll
dfshim.dll v4.0.31106.0 (Main.031106-0000) - C:\Windows\System32\dfshim.dll
mscoreei.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
clr.dll v4.0.30319.208 (NetFXGDR.030319-2000) - C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
ieproxy.dll v8.00.7600.16700 (win7_gdr.101103-1650) - C:\Program Files\Internet Explorer\ieproxy.dll
SXS.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\SXS.DLL
PresentationHostProxy.dll v4.0.31106.0 built by: Main - C:\Windows\System32\PresentationHostProxy.dll
mshtml.dll v8.00.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\mshtml.dll
msls31.dll v3.10.349.0 - C:\Windows\System32\msls31.dll
mlang.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\mlang.dll
msimtf.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\msimtf.dll
IEFRAME.dll v8.00.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\IEFRAME.dll
OLEACC.dll v7.0.0.0 (win7_rtm.090713-1255) - C:\Windows\System32\OLEACC.dll
jscript.dll v5.8.7600.16385 - C:\Windows\System32\jscript.dll
ImgUtil.dll v8.00.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\ImgUtil.dll
pngfilt.dll v8.00.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\pngfilt.dll
mscorlib.ni.dll v4.0.30319.208 (NetFXGDR.030319-2000) - C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\595f7d686dd701145c2ea847c8b1f2f2\mscorlib.ni.dll
nlssorting.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\Microsoft.NET\Framework\v4.0.30319\nlssorting.dll
System.ni.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System\deb30c9cd7f900f3f89599ae0de6e981\System.ni.dll
WindowsBase.ni.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\WindowsBase\82ace6813e9d8ba566ec8be5412173fc\WindowsBase.ni.dll
PresentationCore.ni.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\PresentationCore\b30fd21afcc7aa71cdbb7ccb1461dbca\PresentationCore.ni.dll
PresentationFramework.ni.dll v4.0.30319.208 - C:\Windows\assembly\NativeImages_v4.0.30319_32\PresentationFramewo#\2b6f2725b1c4ce169ae573d43882201b\PresentationFramework.ni.dll
dwrite.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\dwrite.dll
wpfgfx_v0400.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\wpfgfx_v0400.dll
PresentationNative_v0400.dll v4.0.30319.1 built by: RTMRel - C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationNative_v0400.dll
msimg32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\msimg32.dll
System.Xaml.ni.dll v4.0.30319.1 built by: RTMRel - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xaml\8bddc738677b6d82d35234e16c16795d\System.Xaml.ni.dll
System.Deployment.ni.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Deployment\8c14525233b7b0ffcca25f749a882107\System.Deployment.ni.dll
shfolder.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\shfolder.dll
System.Configuration.ni.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\02cc90cedc85b04dd8404bc994fa790d\System.Configuration.ni.dll
System.Xml.ni.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\ebc67665a61ce2cfc579104eef9baaef\System.Xml.ni.dll
winhttp.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\winhttp.dll
webio.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\webio.dll
credssp.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\credssp.dll
dhcpcsvc.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\dhcpcsvc.DLL
dhcpcsvc6.DLL v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\dhcpcsvc6.DLL
clrjit.dll v4.0.30319.208 (NetFXGDR.030319-2000) - C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll
System.Drawing.ni.dll v4.0.30319.1 built by: RTMRel - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\5db5311dd315bddf6d06886b2d80836b\System.Drawing.ni.dll
System.Windows.Forms.ni.dll v4.0.30319.1 built by: RTMRel - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Windows.Forms\9f922fa65357fbb2ac00b4d2b50e8ac3\System.Windows.Forms.ni.dll
System.Security.ni.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Security\103d565371aa5e94f306f83126f6e973\System.Security.ni.dll
WindowsFormsIntegration.ni.dll v4.0.30319.1 built by: RTMRel - C:\Windows\assembly\NativeImages_v4.0.30319_32\WindowsFormsIntegra#\f77cc14703378f6a1b48bef9ce7a0d9e\WindowsFormsIntegration.ni.dll
PresentationFramework.Aero.ni.dll v4.0.30319.1 built by: RTMRel - C:\Windows\assembly\NativeImages_v4.0.30319_32\PresentationFramewo#\f9ef95e945caadb86f526cda8727558b\PresentationFramework.Aero.ni.dll
System.Core.ni.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\03b897be162c89eff7179fe77a5ac53f\System.Core.ni.dll
System.Web.ni.dll v4.0.30319.208 built by: NetFXGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Web\1937fcb7f2ddc396f40731ec9cacc236\System.Web.ni.dll
webengine4.dll v4.0.30319.208 (NetFXGDR.030319-2000) - C:\Windows\Microsoft.NET\Framework\v4.0.30319\webengine4.dll
USERENV.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\USERENV.dll
d3d9.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\d3d9.dll
d3d8thk.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\d3d8thk.dll
nvd3dum.dll v8.15.11.8630 - C:\Windows\System32\nvd3dum.dll
WindowsCodecs.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\WindowsCodecs.dll
WtsApi32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\WtsApi32.dll
WINSTA.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\WINSTA.dll
msctfui.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\msctfui.dll
System.Data.ni.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data\d057d6c1d08f5e835dff400e6f261adc\System.Data.ni.dll
System.Data.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
System.Transactions.ni.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Transactions\3ea12b858675d88d318f13d7eeaff01b\System.Transactions.ni.dll
System.Transactions.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll
System.EnterpriseServices.ni.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\4e64ae80fa8097e3f24630ef55cf6e67\System.EnterpriseServices.ni.dll
System.EnterpriseServices.Wrapper.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\4e64ae80fa8097e3f24630ef55cf6e67\System.EnterpriseServices.Wrapper.dll
System.EnterpriseServices.Wrapper.dll v4.0.30319.1 (RTMRel.030319-0100) - C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll
System.Numerics.ni.dll v4.0.30319.1 built by: RTMRel - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Numerics\c3ecd82b87a3a2c09dd8864a42a2c291\System.Numerics.ni.dll
powrprof.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\powrprof.dll
SETUPAPI.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\SETUPAPI.dll
CFGMGR32.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\CFGMGR32.dll
DEVOBJ.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\system32\DEVOBJ.dll
WINMM.dll v6.1.7600.16385 (win7_rtm.090713-1255) - C:\Windows\System32\WINMM.dll
diasymreader.dll v10.0.30319.1 built by: RTMRel - C:\Windows\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll

1 个答案:

答案 0 :(得分:0)

我们无法对Margin属性进行Animate属性,因为它属于兼容类型System.Window.ThickNess