System.Runtime.InteropServices.COMException error on Windows [SOLVED]

Sophie Luo, in Graphic issues
At times, you might see the following notifications when you are running some applications on your computer:  



Or: 


Or: 


This is rather annoying, since all the information you get from the notification doesn’t seem to make any sense if you are not a developer. Well, to make it easier to understand, these sort of problems are mainly associated with video hardware or driver problems. 

In this post, we will be talking about the following content: 

1. What is WPF render thread? 
2. Why would an application encounter an exception like the one mentioned above? 
3. What are the common reasons for failure?
4. How to fix the problem? 


If you are looking for ways to help you alleviate this problem, you could just go to the last section: 4. How to fix the problem? 


1. What is WPF render thread? 

WPT, stands for Windows Presentation Foundation, is a graphical subsystem for rendering user interfaces(UI) in Windows-based applications by Microsoft, which means that it is part of the Windows operating system. Applications and services developed and executed on Windows opearting system is regarded as WPF applications


Typically, WPF applications start with two threads, one for handling rendering and another for managing the UI. The render thread effectively runs hidden in the background while the UI thread receives input, handles events, paints the screen and runs application code. For WPF content, each UI thread send detailed instructions to the render thread on what to draw. The render thread then takes those instructions and renders the content. 



2. Why would an application encounter an exception like the one mentioned above? 

The above exception usually means that the WPF render thread encountered some fatal error. The causes of fatal erros on the render thread could be varied. Unfortunately, there is no one root bug or issue for why these problems occur, so there is no one specific fix that can be done to alleviate the problem. 

When render thread makes a call into another component, it checks the return value for success or failure. When a failure detected, WPF “zombies” the render partition and notifies the UI thread of the failure the next time these two threads sync. 

For example, if the WPF render thread failed due to some out of memory condition, then it will map the failure to a System.OutOfMemoryException and it would be the exception encountered on the UI thread. 


Due to the design, the exception that you see on the UI thread isn’t typically helpful in diagnosing the actual cause of the problem. This is because the exception is only shown after the failure detected on the render thread and that render thread and UI thread synchronize. And they only synchronize in a few locations. These, plus the lost of critical state on render thread, make it even harder for developers to understand where and why the failure occurred, or know hot to avoid such a problem. 



3. What are the common reasons for failure?

We mentioned above that it is very difficult for us to detect the exact cause of the error, but there are indeed some common causes. Usually speaking, this sort of error is associated with video hardware of driver problems. This is particularly true on Windows XP and 2003 platforms. 

Another common reason is due to the use of layered windows, particularly in Windows XP or 2003. Much of the layered windows implementation in XP is fragile, with a number of bugs that impacted WPF significantly. Starting from Windows Vista, most of the layered problems in Windows have been addressed with the introduction of the Desktop Windows Manager. 



4. How to fix the problem? 

As we mentioned, there is no single cause of this problem, thus no single resolution to the error. The following fixtures are general ways for you to try one by one, hope the problem could be fixed. 

1) Try different video hardware in the problem machine and/or update your video drivers. 

It is suggested that you use Driver Easy to help you with the update of your video drivers. Driver Easy is a free version that helps you detect and download the drivers that you need fast and easily. With the help of it, you are free from all the work of finding and installing the drivers by yourself. There are only two steps involved:

a) Scan.



b) Update




As said, Driver Easy is a free program to use. But if you are looking for more features and professional technical support, you can have a try at the professional version. Professional version not only permits you to update all the drivers in just one click, but also provide you with many more features than the free version. Just have a try now. 

Related post:
How to update video drivers in Windows 10? 
How to update AMD video driver in Windows 8? 
How to update Intel graphics driver in Windows 7? 

2) Upgrade to the latest version and service pack level of the .Net Framework available for your target platform. 

Related post: 
How to install .Net Framework on Windows 10/8.1/8/7? 

3) If you are on Windows XP or Windows 2003, test on a newer operating system, and upgrade if possible. 

4) If System.OutOfMemoryExceptions are reported, then you should monitor the the process’s memory usage in Task Manager. If you can decide which application is exhausting your resource, then troubleshoot the application to fix whatever that resource consumption. It should fix the System.OutOfMemoryExceptions problem in the end. 

5) If the situation that you encounter can be reappeared in different platforms and on different video hardware/driver combinations, then you might have come across some WPF bug. In this case, you can file the bug on the Microsoft connect site: http://connect.microsoft.com/VisualStudio. 
Help Us Improve Article