C # System.ComponentModel.Win32Exception (0x80004005): недостаточно места для обработки этой команды - PullRequest
0 голосов
/ 24 октября 2018

После запуска моего приложения (.Net 4.5, 64-bit, WPF) в течение длительного времени (одна-две недели) я сталкиваюсь со следующим сбоем приложения:

Faulting application name: XY.exe, Version: 2.12.2.2, Time: 0x5bade142
Faulting module name: KERNELBASE.dll, Version: 6.1.7601.24150, Time: 0x5b0cbc65
Exception code: 0xe0434352
Fault offset: 0x000000000001a06d
Faulting process id: 0x8694
Faulting application start time: 0x01d457228a130410
Faulting application path: C:\Testsysteme\YY.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: dbfc630b-c61f-11e8-bc27-1866da0d15ef

Application: XY.exe
Frameworkversion: v4.0.30319
Description: The process was terminated due to an unhandled exception
Exception information: System.ComponentModel.Win32Exception
at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D)
at MS.Win32.HwndWrapper..ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.String, IntPtr, MS.Win32.HwndWrapperHook[])
at System.Windows.Interop.HwndSource.Initialize(System.Windows.Interop.HwndSourceParameters)
at System.Windows.Interop.HwndSource..ctor(System.Windows.Interop.HwndSourceParameters)
at System.Windows.Controls.Primitives.Popup+PopupSecurityHelper.BuildWindow(Int32, Int32, System.Windows.Media.Visual, Boolean, System.Windows.Interop.HwndSourceHook, System.Windows.AutoResizedEventHandler)
at System.Windows.Controls.Primitives.Popup.BuildWindow(System.Windows.Media.Visual)
at System.Windows.Controls.Primitives.Popup.CreateWindow(Boolean)
at System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
at System.Windows.Data.BindingOperations.SetBinding(System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.Data.BindingBase)
at System.Windows.Controls.Primitives.Popup.CreateRootPopup(System.Windows.Controls.Primitives.Popup, System.Windows.UIElement)
at System.Windows.Controls.ToolTip.OnIsOpenChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
at System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)
at System.Windows.Controls.PopupControlService.RaiseToolTipOpeningEvent()
at System.Windows.Threading.DispatcherTimer.FireTick(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at XY.App.Main()

Регистрация необработанного исключения дополнительно показала:

System.ComponentModel.Win32Exception (0x80004005): Not enough storage is available to process this command

Я уже нашел ссылку с базовым описанием проблемы connect.microsoft.com на web.archive.org , и я скачал и запустил AtomMonitor из JordiCorbilla / атом-таблица-монитор (GitHub) .Действительно, я обнаружил, что со временем мое приложение создает все больше атомов RWM (около 4000 через несколько дней).Это соответствует сообщению об исключении.Все строки выглядят следующим образом:

C1FE = HwndWrapper[XY.exe;;b68ce81a-d29f-414b-b63a-3b6979e33dd3]  --RWM

Из сообщения об исключении я вижу, что «всплывающее окно» вызывает RegisterClassEx в методе OnIsOpenChanged.

Однако открытиеи закрывая несколько всплывающих окон в моем приложении и параллельно отслеживая количество атомов RWM, я не вижу никакого увеличения, поэтому я не могу найти точный источник проблемы.Через некоторое время, когда я снова смотрю на статистику, я вижу, что счет увеличился.

Итак, мои вопросы:

  1. Может ли Popup отвечать заподнять количество атомов RWM?Если да, это ошибка?Почему он создает новый Window и регистрирует эти атомы?

  2. Я неправильно использую Popup?Нужно ли что-то закрывать / утилизировать / отпускать?

  3. Является ли проблема Popup проблемой вообще?

  4. Что такое «нормальный»'число атомов RWM, которое приложение создает или не должно превышать, потому что, насколько я знаю, они больше не могут быть удалены.

...