我有一个用C#编写的Windows窗体应用程序,它的目标是.net Framework 4.8。我在客户PC的Windows 7 x86上运行此应用程序。我的应用程序运行良好,但有时我会遇到一个神秘的问题。有时我的应用程序只是拒绝启动,但是当我打开进程浏览器时,我看到MyAplication.exe拥有1MB的RAM。似乎有些东西阻止了我的应用程序。我检查了Windows事件日志,但没有错误。我还尝试在Program.cs的第一行中写入日志文件,但是根本没有发生。我杀死了这个1 MB的进程,然后重新启动了我的应用程序。它会打开并且可以正常工作,或者我必须重新启动几次。我的另一个WPF应用程序甚至来自外部供应商的.net应用程序都遇到了这种1 MB RAM问题。我使用流程浏览器为我的应用程序创建了一个转储文件。在Windows 10的个人PC上,我使用Windows应用商店中的WinDbg应用程序来分析应用程序的转储文件。我看到以下内容:
FAULTING_THREAD: 000002a0
PROCESS_NAME: MyApplication.exe
ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION} Breakpoint A breakpoint has been reached.
EXCEPTION_CODE_STR: 80000003
MISSING_CLR_SYMBOL: 0
STACK_TEXT:
002be670 77176c04 ntdll!KiFastSystemCallRet+0x0
002be674 771765ac ntdll!NtWaitForSingleObject+0xc
002be678 77161db1 ntdll!RtlpWaitOnCriticalSection+0x13e
002be6dc 77161c95 ntdll!RtlEnterCriticalSection+0x150
002be704 76e5cc0f rpcrt4!PerformRpcInitialization+0x29
002be748 76e665fd rpcrt4!RpcStringBindingComposeW+0x15
002be758 72ab1ec0 DialogFilterProc!InitDialogFilterProc+0x32d
002be810 72ab18b3 DialogFilterProc!ReleaseDialogFilterProc+0x17d
002be828 72ab2157 DialogFilterProc!InitDialogFilterProc+0x5c4
002be844 72ab22be DialogFilterProc!InitDialogFilterProc+0x72b
002be8a4 771887cc ntdll!LdrpCallInitRoutine+0x14
002be8c4 77195adb ntdll!LdrpRunInitializeRoutines+0x26f
002be9b8 7718faf2 ntdll!LdrpLoadDll+0x472
002beb2c 77192105 ntdll!LdrLoadDll+0xaf
002beb64 7523b246 KERNELBASE!LoadLibraryExW+0x215
002bebac 772aefa4 user32!__ClientLoadLibrary+0x60
002bece0 77176b3e ntdll!KiUserCallbackDispatcher+0x2e
002bed7c 772b4f21 user32!NtUserMessageCall+0xc
002bed80 772e5d6e user32!CallNextHookEx+0x10b
002bedb0 6d460ef0 tiptsf!TabletCallWndProc+0x5f
002bedd0 772a7a02 user32!DispatchHookW+0x33
002bedec 772a4999 user32!fnHkINLPCWPSTRUCTW+0x52
002bee20 772ae952 user32!__fnINLPCREATESTRUCT+0x8b
002bee50 77176b3e ntdll!KiUserCallbackDispatcher+0x2e
002beec4 772aeb5c user32!NtUserCreateWindowEx+0xc
002beec8 772aeaf0 user32!VerNtUserCreateWindowEx+0x1a3
002bf16c 772aec1c user32!_CreateWindowEx+0x201
002bf218 772aec77 user32!CreateWindowExW+0x33
002bf254 7682633f ole32!InitMainThreadWnd+0x3e
002bf28c 768263fc ole32!wCoInitializeEx+0xef
002bf2a4 768209ff ole32!CoInitializeEx+0x2ee
002bf2c4 7124ab8f clr!Thread::SetApartment+0x13b
002bf310 7123e1b7 clr!SystemDomain::SetThreadAptState+0x92
002bf330 7123e892 clr!SystemDomain::ExecuteMainMethod+0x18c
002bf810 71242498 clr!ExecuteEXE+0x4c
002bf868 712425be clr!_CorExeMainInternal+0xdc
002bf8a8 7123def5 clr!_CorExeMain+0x4d
002bf8e4 7185fa84 mscoreei!_CorExeMain+0xd6
002bf91c 718e7f16 mscoree!ShellShim__CorExeMain+0x99
002bf92c 718e4de3 mscoree!_CorExeMain_Exported+0x8
002bf934 7616ef3c kernel32!BaseThreadInitThunk+0xe
002bf940 77193618 ntdll!__RtlUserThreadStart+0x70
002bf980 771935eb ntdll!_RtlUserThreadStart+0x1b
SYMBOL_NAME: DialogFilterProc!InitDialogFilterProc+32d
MODULE_NAME: DialogFilterProc
IMAGE_NAME: DialogFilterProc.dll
STACK_COMMAND: .ecxr ; kb ; dt ntdll!LdrpLastDllInitializer BaseDllName ; dt ntdll!LdrpFailureData ; ** Pseudo Context ** Pseudo ** Value: 88f6c30 ** ; kb
FAILURE_BUCKET_ID: BREAKPOINT_80000003_DialogFilterProc.dll!InitDialogFilterProc
OSPLATFORM_TYPE: x86
OSNAME: Windows 7
IMAGE_VERSION: 1.0.299.0
FAILURE_ID_HASH: {e56a1c21-26f9-3e25-d015-b9f79339b457}
Followup: MachineOwner
PS:我禁用了防病毒软件和Windows Defender,但是它不能解决我的问题。客户的PC上没有互联网。不知道这是否会对我的问题产生影响。
谁能帮助我解决这个神秘的问题?任何想法都非常感谢!
让我们读取调用堆栈
clr!_CorExeMain
clr!_CorExeMainInternal
达到管理代码的主要方法(SystemDomain :: ExecuteMainMethod)
clr!ExecuteEXE
clr!SystemDomain::ExecuteMainMethod
clr!SystemDomain::SetThreadAptState
您最可能在Main方法上具有STAThread Apartment属性,因为已设置COM Appartmentstate Thread :: SetApartment
clr!Thread::SetApartment
COM初始化(CoInitializeEx)
ole32!CoInitializeEx
ole32!wCoInitializeEx
ole32!InitMainThreadWnd
COM需要隐藏的窗口来抽取消息(CreateWindowExW)
user32!CreateWindowExW
user32!_CreateWindowEx
user32!VerNtUserCreateWindowEx
user32!NtUserCreateWindowEx
ntdll!KiUserCallbackDispatcher
user32!__fnINLPCREATESTRUCT
user32!fnHkINLPCWPSTRUCTW
user32!DispatchHookW
在这种情况下,tiptsf已将(DispatchHookW)挂钩到窗口创建中以注入其自身的功能(TabletCallWndProc)。我怀疑这是来自Microsoft Ink的。
tiptsf!TabletCallWndProc
user32!CallNextHookEx
user32!NtUserMessageCall
ntdll!KiUserCallbackDispatcher
user32!__ClientLoadLibrary
这会加载一些扩展dll
KERNELBASE!LoadLibraryExW
ntdll!LdrLoadDll
ntdll!LdrpLoadDll
ntdll!LdrpRunInitializeRoutines
ntdll!LdrpCallInitRoutine
现在,我们初始化DialogFilterProc,它在2012年左右的Windows 7中有问题
在我的Win10机器上,我没有找到此DialogFilterProc。这是Windows 7计算机吗?此文档完全没有记录,因此在此尝试执行的操作信息很少。据此,这似乎是一个可能被禁用的系统服务,因此死机了。
DialogFilterProc!InitDialogFilterProc
DialogFilterProc!InitDialogFilterProc
DialogFilterProc!ReleaseDialogFilterProc
DialogFilterProc!InitDialogFilterProc
DialogFilter调用RpcStringBindingComposeW显然挂起。从文档中,我可以看到它处理进程间通信。COM单元尚未完全初始化,这会导致此RPC方法挂起,或者无法建立远程连接。有关使用此方法的示例,请参见此处的示例。
rpcrt4!RpcStringBindingComposeW
rpcrt4!PerformRpcInitialization
ntdll!RtlEnterCriticalSection
ntdll!RtlpWaitOnCriticalSection
ntdll!NtWaitForSingleObject
ntdll!KiFastSystemCallRet
如果第一个问题是Microsoft Ink的过早加载,则可以尝试禁用它,并检查是否可以解决您的问题。如果问题仍然存在,则可以尝试在主要方法上设置[STAThread]或[MTAThread]属性。也许其他公寓模式也可以解决您的僵局。或者,如果确实是对话框过滤器试图调用已崩溃或未运行的服务,则您需要重新启动服务以弹出UI。正如我可以(希望)向您展示的那样,很容易从任何方法中找出正在执行的操作以及如何将其关闭。基于此,您现在应该有更多的选择,可以探究实际的根本原因或找到不正确的解决方法。
您的DialogFilterProc.dll的版本为1.0.299.0,似乎比2012年的修订版中具有1.0.542.0的版本更旧。安装古老的修补程序可以解决您的问题。
> File name File version File size Date Time Platform
> Dialogfilterproc.dll 1.0.542.0 13,312 24-Jul-12 17:11 x86
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句