简体   繁体   English

将“开始”菜单中的项目拖动到WPF应用程序时会崩溃

[英]WPF application crashes when item from Start Menu is dragged over it

I've encountered a strange problem. 我遇到了一个奇怪的问题。 When an item from the Windows start menu is dragged over the application, it crashes. 将Windows“开始”菜单中的项目拖到应用程序上时,它会崩溃。

However, if I drag a file from Explorer over it, it is handled correctly (the dragged item displays a red circle with a line through it when it is over my application). 但是,如果我从资源管理器中将文件拖到该文件上,则可以正确处理该文件(当该文件在我的应用程序上方时,该拖拽的项目会显示一个红色圆圈,并带有一条直线)。

And this is where the strange thing happens. 这就是奇怪的事情发生的地方。 Now that I have tried dragging the file from Explorer over it, the program doesn't crash when I try dragging an item from the Start Menu. 既然我已经尝试从资源管理器中拖动文件了,那么当我尝试从“开始”菜单中拖动项目时,程序不会崩溃。 It only crashes if the first dragged item after startup of the application is from the Start Menu. 只有在启动应用程序后从“开始”菜单中拖动的第一个项目时,它才会崩溃。

The window and all the controls within have AllowDrop="False" . 窗口和其中的所有控件都具有AllowDrop="False" I've tried adding event handlers for DragOver and DragEnter on the outer most control, but the breakpoints are never hit. 我试过在最外面的控件上为DragOverDragEnter添加事件处理程序,但断点从未被命中。

This is the exception I get: 这是我得到的例外:

Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. 托管调试助手'FatalExecutionEngineError':'运行时遇到致命错误。 The address of the error was at 0xc789d078, on thread 0x59f4. 错误的地址位于线程0x59f4上的0xc789d078。 The error code is 0x80131623. 错误代码为0x80131623。 This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. 此错误可能是CLR或用户代码中不安全或不可验证部分的错误。 Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.' 该错误的常见来源包括COM-interop或PInvoke的用户封送处理错误,这些错误可能会破坏堆栈。

Followed by this exception: 随后出现此异常:

System.ExecutionEngineException: 'Exception of type 'System.ExecutionEngineException' was thrown.' 'System.ExecutionEngineException:'抛出了类型为'System.ExecutionEngineException'的异常。

And the application exits. 然后应用程序退出。

I'm using Windows 10 and 64bit. 我正在使用Windows 10和64位。 .NET Framework 4.7.2 .NET Framework 4.7.2

Call stack: 调用堆栈:

  [External Code] DataExchange.dll!CWinRtTarget::DragOver(struct IDragDropArgsPriv *,struct IDragUIOverridePriv * *) Unknown rpcrt4.dll!Invoke() Unknown rpcrt4.dll!Ndr64StubWorker() Unknown rpcrt4.dll!NdrStubCall3() Unknown combase.dll!CStdStubBuffer_Invoke(IRpcStubBuffer * This, tagRPCOLEMESSAGE * prpcmsg, IRpcChannelBuffer * pRpcChannelBuffer) Line 1524 C++ rpcrt4.dll!CStdStubBuffer_Invoke() Unknown [Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing::__l6::<lambda_76d9e92c799d246a4afbe64a2bf5673d>::operator()() Line 1907 C++ combase.dll!ObjectMethodExceptionHandlingAction<<lambda_76d9e92c799d246a4afbe64a2bf5673d> >(InvokeStubWithExceptionPolicyAndTracing::__l6::<lambda_76d9e92c799d246a4afbe64a2bf5673d> action, ObjectMethodExceptionHandlingInfo * pExceptionHandlingInfo, ExceptionHandlingResult * pExceptionHandlingResult, void *) Line 91 C++ [Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing(IRpcStubBuffer * pMsg, tagRPCOLEMESSAGE *) Line 1905 C++ combase.dll!DefaultStubInvoke(bool bIsAsyncBeginMethod, IServerCall * pServerCall, IRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 1974 C++ [Inline Frame] combase.dll!SyncStubCall::Invoke(IServerCall *) Line 2031 C++ [Inline Frame] combase.dll!SyncServerCall::StubInvoke(IRpcChannelBuffer *) Line 807 C++ [Inline Frame] combase.dll!StubInvoke(tagRPCOLEMESSAGE * pMsg, CStdIdentity * pStdID, IRpcStubBuffer *) Line 2257 C++ combase.dll!ServerCall::ContextInvoke(tagRPCOLEMESSAGE * pMessage, IRpcStubBuffer * pStub, CServerChannel * pChannel, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 1542 C++ [Inline Frame] combase.dll!CServerChannel::ContextInvoke(tagRPCOLEMESSAGE *) Line 1438 C++ [Inline Frame] combase.dll!DefaultInvokeInApartment(tagRPCOLEMESSAGE *) Line 3549 C++ [Inline Frame] combase.dll!ClassicSTAInvokeInApartment(ServerCall *) Line 3313 C++ combase.dll!AppInvoke(ServerCall * pServerCall, CServerChannel * pChannel, IRpcStubBuffer * pStub, void * pv, void * pStubBuffer, tagIPIDEntry * pIPIDEntry, WireLocalThis * pLocalb) Line 1688 C++ combase.dll!ComInvokeWithLockAndIPID(ServerCall * pServerCall, tagIPIDEntry * pIPIDEntry, bool * pbCallerResponsibleForRequestMessageCleanup) Line 2804 C++ [Inline Frame] combase.dll!ComInvoke(ServerCall *) Line 2326 C++ combase.dll!ThreadDispatch(ServerCall * pServerCall) Line 422 C++ combase.dll!ThreadWndProc(HWND__ * window, unsigned int message, unsigned __int64 wparam, __int64 params) Line 798 C++ user32.dll!UserCallWinProcCheckWow() Unknown user32.dll!DispatchMessageWorker() Unknown WindowsBase.ni.dll!00007ffbc7f8f138() Unknown 

The same symptoms occur on my computer The same is true for any WPF-created app. 我的计算机上出现相同的症状对于任何WPF创建的应用程序也是如此。 Reopen the start menu to fix it. 重新打开开始菜单进行修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM