运行时错误(Runtime Error)是在运行或执行程序时发生的错误。发生此错误时,程序可能会挂起或崩溃并显示错误消息。运行时错误有很多原因,例如当程序进入无限循环时,它会触发运行时错误。有时,也因用户的过错而发生。例如,一个程序需要一个数值来处理结果,但如果用户输入了所需值以外的任何值,例如字母字符,则程序可能会显示运行时错误。
为什么以及何时发生运行时错误?
用户在他们的计算机上遇到运行时错误的原因有很多。我们将在这里描述最重要的原因:
- 内存泄漏。
- 编程错误。
- 安装不完整。
- 损坏的注册表。
1]内存泄漏
内存泄漏(memory leak)是Windows计算机上运行时错误的最常见原因。当程序错误地管理内存分配时会发生这种情况,例如消耗更多的RAM而没有释放它。当正在运行的代码无法访问存储在内存中的对象时,也会发生内存泄漏。
2]编程错误
编程错误也会导致运行时错误。当软件处于开发阶段时,可以在调试过程中发现运行时错误,以便开发人员在发布之前进行纠正。但是,如果错误地在软件中留下任何错误,则可能导致运行时错误。在这种情况下,运行时错误只能通过从开发者网站下载更新补丁来解决。
修复:(Fix:) AppModel 运行时错误 57、87、490(AppModel Runtime Errors 57, 87, 490)等。
3]安装不完整
有时,当用户安装程序时,安装程序会突然退出。这种中断有很多原因,如电源故障、系统挂起等。这会导致安装不完整,从而可能导致系统运行时错误。
修复(Fix):AppModel 运行时错误 65、69 和 79(AppModel Runtime Errors 65, 69, and 79)。
4] 损坏的注册表
损坏或损坏的注册表可能会导致程序出现故障,因此您可能会遇到运行时错误。注册表损坏的原因有很多。主要原因之一是注册表中的手动更改。因此(Hence),在编辑注册表项时应该小心。在对注册表进行任何更改之前备份注册表始终是最佳做法。
阅读(Read):Fix NVIDIA GeForce Experience C++ Runtime Error。
如何修复Windows 11/10上的运行时错误(Runtime Error)
由于存在许多不同的运行时错误,因此修复它们的方法也不相同。我们在这里列出了一些可以帮助您解决大多数运行时错误的通用方法。
- 安装最新的Microsoft Visual C++ Redistributable包。
- 运行 DISM 命令和 SFC 扫描。
- 在干净启动状态下进行故障排除。
1] 安装最新的Microsoft Visual C++ Redistributable包
一些用户报告说他们在更新Windows 11/10后开始出现运行时错误。他们收到的错误消息是:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Users\….
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
据用户称,每次打开计算机时都会出现显示错误消息的弹出窗口,如果他们关闭窗口,则会再次出现。由于软件问题或缺少Visual C++库的运行时组件,会发生此类运行时错误。
在这种情况下,在卸载现有软件包后安装最新的Microsoft Visual C++ Redistributable请按照下列步骤操作:
- 启动控制面板并转到“程序和功能(Programs and Features)”。
- 点击“卸载程序(Uninstall a Program)”。
- 向下滚动(Scroll)列表以查找Microsoft Visual C++ Redistributable。
- 右键单击它并选择Uninstall。这将从您的计算机中卸载该软件包。
- 现在,从Microsoft官方网站下载最新的Microsoft Visual C++ Redistributable Package
- 安装它并重新启动计算机。
这在大多数情况下都有效。
阅读(Read):修复运行时错误 217(Runtime Error 217)。
2]运行DISM命令和SFC扫描
系统文件检查器(System File Checker)( SFC ) 工具用于扫描和修复损坏的文件,而DISM(部署映像服务(Deployment Image Servicing)和管理(Management)工具)用于修复损坏的Windows系统映像文件。运行这些工具将帮助您修复运行时错误。
要运行系统文件检查器,请在提升的 CMD 中执行以下命令:
sfc /scannow
要运行 DISM(run DISM),请以管理员身份打开命令提示符(Command Prompt)并键入以下命令并按Enter。
DISM.exe /Online /Cleanup-image /Restorehealth
DISM工具使用Windows更新(Windows)来修复损坏的文件。
阅读(Read):修复 Excel 中的运行时错误 1004(Fix Runtime Error 1004 in Excel)。
3]在干净启动状态下进行故障排除
有时第三方程序可能是罪魁祸首。在这种情况下,执行干净启动(performing a clean boot)可能有助于解决问题。
Clean Boot将帮助您确定系统上是否存在导致运行时错误的第三方或启动应用程序。
希望这篇文章能引导你朝着正确的方向前进。
相关帖子(Related posts):
What are Runtime Errors? Their causes and How to fix them?
A Runtime Error is an error that occurs at the time of running or executing a program. When this error occurs, the program may hang or crash displaying an error message. There are many reasons for a runtime error, like when the program enters an infinite loop, it triggers the runtime error. Sometimes, it also occurs due to the user’s fault. For example, a program requires a numerical value to process the result, but if the user enters any value other than the required one, say, alphabetic character, the program may show a runtime error.
Why and when do runtime errors occur?
There are many reasons for which the users get runtime errors on their computers. We will describe the most significant reasons here:
- Memory leak.
- Programming errors.
- Incomplete installation.
- Corrupt registry.
1] Memory leak
A memory leak is the most common cause of a runtime error on a Windows computer. It occurs when a program incorrectly manages the memory allocations, such as consuming more RAM without freeing it. A memory leak also occurs when the running code cannot access an object stored in the memory.
2] Programming errors
Programming errors also cause runtime errors. When a software is in the development phase, runtime errors can be found during the debugging process so that the developer can correct them before it is being released. But if any bug is left in the software by mistake, it can cause runtime errors. In such a case, the runtime errors can only be solved by downloading the update patches from the developer’s website.
Fix: AppModel Runtime Errors 57, 87, 490, etc.
3] Incomplete installation
Sometimes when a user is installing a program, the installer quits abruptly. There are many reasons for this interruption like power failure, system hangs, etc. This results in incomplete installation which may cause runtime errors on the system.
Fix: AppModel Runtime Errors 65, 69, and 79.
4] Corrupt registry
A corrupted or damaged registry can cause programs to malfunction due to which you may get a runtime error. There are many causes for the registry damage. One of the main reasons is a manual change in the registry. Hence, you should be careful while editing the registry keys. Backing up the registry before making any change to it is always be the best practice.
Read: Fix NVIDIA GeForce Experience C++ Runtime Error.
How to fix a Runtime Error on Windows 11/10
Because there are many different runtime errors, the method to fix them is not the same. We are listing here some general methods that may help you solve most of the runtime errors.
- Install the latest Microsoft Visual C++ Redistributable package.
- Run DISM command and SFC scan.
- Troubleshoot in Clean Boot State.
1] Install the latest Microsoft Visual C++ Redistributable package
Some users have reported that they have started getting runtime errors after updating Windows 11/10. The error message that they received is:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Users\….
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
According to the users, the popup window showing the error message arrives every time they turn ON their computer and comes back again if they close the window. Such a runtime error occurs due to a software problem or when the runtime components of the Visual C++ libraries are missing.
In such a condition, installing the latest Microsoft Visual C++ Redistributable package after uninstalling the existing one may help. Follow the below-listed steps:
- Launch Control Panel and go to “Programs and Features.”
- Click on “Uninstall a Program.”
- Scroll down the list to find Microsoft Visual C++ Redistributable.
- Right-click on it and select Uninstall. This will uninstall the package from your computer.
- Now, download the latest Microsoft Visual C++ Redistributable Package from the Microsoft official website.
- Install it and restart your computer.
This works in most cases.
Read: Fix Runtime Error 217.
2] Run DISM command and SFC scan
System File Checker (SFC) tool is used to scan and repair the corrupted files, whereas, DISM (Deployment Image Servicing and Management tool) is used to repair the corrupted Windows system image files. Running these tools will help you fix the runtime errors.
To run System File Checker, execute the following command in an elevated CMD:
sfc /scannow
To run DISM, open Command Prompt as an administrator and type the following command and press Enter.
DISM.exe /Online /Cleanup-image /Restorehealth
The DISM tool uses Windows update to fix the corrupted files.
Read: Fix Runtime Error 1004 in Excel.
3] Troubleshoot in Clean Boot State
Sometimes a third-party program may be the culprit. In this case, performing a clean boot may help troubleshoot the problem.
Clean Boot will help you identify if there is a third-party or startup application on your system that is causing the runtime error.
Hope this post guides you in the right direction.
Related posts: