WPF应用程序在ToolTip上冻结(仅在Visual Studio中)

时间:2018-03-21 15:05:54

标签: c# c++ wpf visual-studio-2017

VS2010 WPF项目(如果重要的话,使用非托管代码)升级到 VS2017 (以及其他一些其他升级,例如Cuda),运行时应用程序,一切都有效,直到需要出现工具提示。 奇怪的是,只有在使用调试器运行代码时才会发生(在VS内部),但运行时没有它可以正常运行(Ctrl + F5或.exe直接)。

工具提示是一个简单的文本框工具提示(添加ToolTipService.InitialShowDelay="5000"会使冻结延迟在5秒内完成。)

在冻结发生时暂停应用程序,主线程的堆栈跟踪显示应用程序在WaitForSingleObject被触发后卡在ntdll.dll RaiseToolTipOpeningEvent上{I&#39} ; m假设之前的部分与WPF的提升工具提示的机制有轻微的延迟相关。)

这是堆栈:

ntdll.dll!NtWaitForSingleObject()  Unknown Symbols loaded.
KernelBase.dll!WaitForSingleObjectEx() Unknown Symbols loaded.
combase.dll!CDllHost::MTAInitializeActivators() Line 830    C++ Symbols loaded.
combase.dll!CDllHost::GetApartmentActivators(unsigned long & hCOMActivator, unsigned long & hWinRTActivator) Line 622   C++ Symbols loaded.
[Inline Frame] combase.dll!CDllHost::GetCOMApartmentActivator(unsigned long &) Line 133 C++ Symbols loaded.
[Inline Frame] combase.dll!DoATApartmentCreate(unsigned long &) Line 225    C++ Symbols loaded.
combase.dll!CClassCache::GetActivatorFromDllHost(int fSixteenBit, int isActivatingAppInstalledClass, unsigned long dwDllThreadModel, unsigned long * phActivator) Line 3643 C++ Symbols loaded.
combase.dll!CProcessActivator::GetApartmentActivator(ActivationPropertiesIn * pInActProperties, ISystemActivator * * ppActivator) Line 1093 C++ Symbols loaded.
combase.dll!CProcessActivator::CCICallback(unsigned long dwContext, IUnknown * pUnkOuter, ActivationPropertiesIn * pActIn, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties) Line 1601   C++ Symbols loaded.
combase.dll!CProcessActivator::AttemptActivation(ActivationPropertiesIn * pActIn, IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties, HRESULT(CProcessActivator::*)(unsigned long, IUnknown *, ActivationPropertiesIn *, IActivationPropertiesIn *, IActivationPropertiesOut * *) pfnCtxActCallback, unsigned long dwContext) Line 1524  C++ Symbols loaded.
combase.dll!CProcessActivator::ActivateByContext(ActivationPropertiesIn * pActIn, IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties, HRESULT(CProcessActivator::*)(unsigned long, IUnknown *, ActivationPropertiesIn *, IActivationPropertiesIn *, IActivationPropertiesOut * *) pfnCtxActCallback) Line 1368   C++ Symbols loaded.
combase.dll!CProcessActivator::CreateInstance(IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties) Line 1268  C++ Symbols loaded.
combase.dll!ActivationPropertiesIn::DelegateCreateInstance(IUnknown * pUnkOuter, IActivationPropertiesOut * * ppActPropsOut) Line 1932  C++ Symbols loaded.
combase.dll!CClientContextActivator::CreateInstance(IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties) Line 567 C++ Symbols loaded.
combase.dll!ActivationPropertiesIn::DelegateCreateInstance(IUnknown * pUnkOuter, IActivationPropertiesOut * * ppActPropsOut) Line 1984  C++ Symbols loaded.
combase.dll!ICoCreateInstanceEx(const _GUID & OriginalClsid, IUnknown * punkOuter, unsigned long dwClsCtx, _COSERVERINFO * pServerInfo, unsigned long dwCount, unsigned long dwActvFlags, tagMULTI_QI * pResults, ActivationPropertiesIn * pActIn) Line 1935    C++ Symbols loaded.
combase.dll!CComActivator::DoCreateInstance(const _GUID & Clsid, IUnknown * punkOuter, unsigned long dwClsCtx, _COSERVERINFO * pServerInfo, unsigned long dwCount, tagMULTI_QI * pResults, ActivationPropertiesIn * pActIn) Line 385    C++ Symbols loaded.
[Inline Frame] combase.dll!CoCreateInstanceEx(const _GUID &) Line 176   C++ Symbols loaded.
combase.dll!CoCreateInstance(const _GUID & rclsid, IUnknown * pUnkOuter, unsigned long dwContext, const _GUID & riid, void * * ppv) Line 120    C++ Symbols loaded.
PGHook.dll!00007ffd375410a4()   Unknown No symbols loaded.
UIAutomationCore.dll!BlockingCoreDispatcher::CreateAndRegisterBlockingCore(void)    Unknown Symbols loaded.
UIAutomationCore.dll!BlockingCoreDispatcher::FinalConstruct(void)   Unknown Symbols loaded.
UIAutomationCore.dll!CUIAutomation7::FinalConstruct(void)   Unknown Symbols loaded.
UIAutomationCore.dll!ATL::CComObject<class CUIAutomation7>::CreateInstance(class ATL::CComObject<class CUIAutomation7> * *) Unknown Symbols loaded.
UIAutomationCore.dll!UiaReturnRawElementProvider() Unknown Symbols loaded.
UIAutomationProvider.ni.dll!00007ffd1ab2a933()  Unknown No symbols loaded.
[Managed to Native Transition]      Annotated Frame
UIAutomationProvider.dll!System.Windows.Automation.Provider.AutomationInteropProvider.ReturnRawElementProvider(System.IntPtr hwnd, System.IntPtr wParam, System.IntPtr lParam, System.Windows.Automation.Provider.IRawElementProviderSimple el) Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.PopupSecurityHelper.ForceMsaaToUiaBridge(System.Windows.Controls.Primitives.PopupRoot popupRoot) Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.CreateWindow(bool asyncCall) Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e)  Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e)  Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e)    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args)    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal)    Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Data.BindingOperations.SetBinding(System.Windows.DependencyObject target, System.Windows.DependencyProperty dp, System.Windows.Data.BindingBase binding)   Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.CreateRootPopup(System.Windows.Controls.Primitives.Popup popup, System.Windows.UIElement child)  Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Controls.ToolTip.OnIsOpenChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e)   Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e)  Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e)    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args)    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal)    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value)    Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Controls.PopupControlService.RaiseToolTipOpeningEvent()    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.DispatcherTimer.FireTick(object unused)    Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()   Unknown Symbols loaded.
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)   Unknown Symbols loaded.
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954  C#  Symbols loaded.
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902  C#  Symbols loaded.
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 891    C#  Symbols loaded.
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state)  Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()   Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()  Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  Unknown Symbols loaded.
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown Symbols loaded.
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown Symbols loaded.
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)   Unknown Symbols loaded.
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)  Unknown Symbols loaded.
[Native to Managed Transition]      Annotated Frame
user32.dll!UserCallWinProcCheckWow()    Unknown Symbols loaded.
user32.dll!DispatchMessageWorker()  Unknown Symbols loaded.
WindowsBase.ni.dll!00007ffce783bd98()   Unknown No symbols loaded.
[Managed to Native Transition]      Annotated Frame
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)   Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)   Unknown Symbols loaded.
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)  Unknown Symbols loaded.
MyApplication.exe!MyApplication.App.Main()  Unknown Symbols loaded.
[Native to Managed Transition]      Annotated Frame
mscoreei.dll!_CorExeMain() Unknown Symbols loaded.
mscoree.dll!_CorExeMain_Exported() Unknown Symbols loaded.
kernel32.dll!BaseThreadInitThunk() Unknown Symbols loaded.
ntdll.dll!RtlUserThreadStart() Unknown Symbols loaded.

我无法通过不发出上述等待对象的信号来找到阻止主线程的任何线程。我尝试过返回.NET 4.5.1(现在使用4.7),但它没有效果。

当直接运行可执行文件并附加到进程时,它也可以正常工作,因此我将加载时使用的模块与调试器进行了比较,并且在没有调试器的情况下运行时甚至不加载ntdll.dll(这让我更加困惑。)

搜索网络并没有给我带来任何帮助或建议。

0 个答案:

没有答案