WPF应用程序中EffectiveValueEntry.set_IsDeferredReference中的MethodAccessException [英] MethodAccessException in EffectiveValueEntry.set_IsDeferredReference in WPF application

查看:65
本文介绍了WPF应用程序中EffectiveValueEntry.set_IsDeferredReference中的MethodAccessException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有2个应用程序-都是.NET 3.5 WinForms应用程序,其中有几个通过元素主机使用WPF的地方.当试图构造任何包含WPF控件的东西时,两个应用程序都会收到一个异常,并且仅在单个事件上发生 机器.我们试图删除.NET 3.5 SP1并重新安装-它没有帮助.安装了所有已更新的Windows,但也无济于事.

I have 2 applications - both are .NET 3.5 WinForms applications with several places where WPF is used via element host. Both applications receive an exception when trying to construct anything that contains WPF controls and this only happens on one single machine. We have tried to remove .NET 3.5 SP1 and install it again - it didn't help. Installed all Windows updated - didn't help either.

这两个应用程序均显示出不同的堆叠堆栈跟踪,第一个:

Both applications shows different stack trace in exeptions, first one:

System.Windows.EffectiveValueEntry.set_IsDeferredReference
(Boolean) at System.Windows.FrameworkElement.GetRawValue(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& entry) ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MethodAccessException: System.Windows.EffectiveValueEntry.set_IsDeferredReference(Boolean) at System.Windows.FrameworkElement.GetRawValue(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& entry) at System.Windows.FrameworkElement.EvaluateBaseValueCore(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& newEntry) at System.Windows.DependencyObject.EvaluateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, OperationType operationType) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp) at System.Windows.FrameworkElement.UpdateStyleProperty() at System.Windows.FrameworkElement.OnInitialized(EventArgs e) at System.Windows.FrameworkElement.TryFireInitialized() at System.Windows.FrameworkElement.AddLogicalChild(Object child) at System.Windows.Controls.Decorator.set_Child(UIElement value) at System.Windows.Documents.AdornerDecorator.set_Child(UIElement value) at System.Windows.Forms.Integration.ElementHost..ctor() ....rest of stack removed - it is coming from InitializeComponent method of WinForms form.

 

第二个例外:

Second exception:

Type : System.OutOfMemoryException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  Message : Insufficient memory to continue the execution of the program.
  Source : PresentationCore
  Help link :
  Data : System.Collections.ListDictionaryInternal
  TargetSite : Void NotifyPartitionIsZombie(Int32)
  Stack Trace :  at System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32 failureCode)
    at System.Windows.Media.MediaContext.NotifyChannelMessage()
    at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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, Boolean isSingleParameter)
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
    at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
    at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
    at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(Form mainForm)

不用说,尽管有异常说明,但内存不足没有问题.

Needless to say, there is no problem with insufficient memory, despite what exception says.

 

有什么想法吗?谢谢!

推荐答案

菲利普·帕特里克你好,

Hi Philip Patrick,

根据我的了解,这可能与winform和托管的WPF控件的特定代码逻辑有关.例如,马歇尔没有适当地收集资源.我们需要更多信息才能找到此问题的根本原因. 如果您可以发布一些代码片段,或者将准备好运行的演示上传到您的Skydrive空间并在此处保留链接,那会更好.由于问题仅在一台机器上发生,请您提供一些规格吗?

Based on my knowledge this may be related to your specific code logic of the winform and the WPF control hosted. For example the marshall didn't collect the resoure appropriately. We need a litter more information to find the root cause of this issue. It would be better if you could post some code snippets of it, or upload a ready to run demo to your Skydrive space and leave a link here. Since the problem occurs only on one machine, could you please also offer some specs of it?

最诚挚的问候


这篇关于WPF应用程序中EffectiveValueEntry.set_IsDeferredReference中的MethodAccessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆