Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28323 Discussions

Recurring Visual Studio -> Exception from HRESULT: 0x80040200


I don't know if I have missed something, but I get this IDE exception very often (dozens of times per day) when I try to build a solution and the only remedy is to close the solution and reopen it. Anything else and the exception just repeats, and compilation is not possible. It is not even possible to use clean at this point.

Visual Studio 17.3.6, IFORT 2021.7.0 Build 20220726_000000

I tried completely uninstalling Intel Fortran and reinstalling it, but this doesn't help.

Visual Studio with IFORT is working great except for this.

What little I have been able to search out on this from Visual Studio side says this is not a VS issue but is from the integration. It shows in the Build Output window so I assume it is coming from IFORT or the integration with VS. The IFORT command line build still works fine.

I just am coming up empty finding any mention of the problem from IFORT side, so just asking is this an individual issue.

Labels (1)
0 Kudos
9 Replies
Black Belt

Can you post the Build Log? (when error occurs)

Jim Dempsey



0 Kudos

BuildLog.htm doesn't get updated with this exception.

The Build window in Visual Studio shows:

Build started...
1>Error: Exception from HRESULT: 0x80040200
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

and that's it.

I appreciate any advice as to where to look further.

0 Kudos
Black Belt

In Visual Studio, what does it say for Intel Fortran Compiler when you do Help > About? That particular error is a COM error, so yeah, the Fortran integration could be involved. I haven't seen this reported before.

Can you create and build a new sample project without the error, or is it only this one solution?

0 Kudos

It is any solution, not just the one.  I created just a simple one and built it and it threw after about the third compile. The Build Log just shows the previous build, no errors, worked fine. Then when I select Rebuild, in this case, it immediately throws exception.

If this is unusual, not experienced by others, should I completely uninstall Visual Studio and Fortran and start over? It would not be difficult, and I am not currently using the C# stuff so I can install clean C++ Desktop with Fortran and see if there is a conflict that gets resolved. Maybe my installation, over time, is at fault; it has changed a bit in the last couple months.

Output window:

Rebuild started...
1>Error: Exception from HRESULT: 0x80040200
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

About Visual Studio:

Microsoft Visual Studio Community 2022
Version 17.3.6
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

Visual C++ 2022 00482-90000-00000-AA550
Microsoft Visual C++ 2022

ASP.NET and Web Tools 17.3.376.3011
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.3.376.3011
Azure App Service Tools v3.0.0

C# Tools 4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Intel® Fortran Compiler Package ID: w_oneAPI_2022.2.0.9540
Intel® Fortran Compiler – toolkit version: 2022.3.0, extension version 22.0.0068.17, Package ID: w_oneAPI_2022.2.0.9540, Copyright © 2002-2022 Intel Corporation. All rights reserved.
* Other names and brands may be claimed as the property of others.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

NuGet Package Manager 6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

Visual Basic Tools 4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

0 Kudos
Honored Contributor II

@TommyNorthAL ,

See this thread at this forum:

If you look at the bottom of the comment there, you will find a zip file with a sample Visual Studio solution with two projects, one toward a (unmanaged i.e., native) C++ DLL and another for a calling Fortran program.  You can try to download the zip, extract the files to a folder, give it a try with your version of Visual Studio 2022 and Intel Fortran 2021.7, and see if even this project gives you the HRESULT exception error.  I was the author of that sample Visual Studio solution who put it together to help another reader here.  

Now I just retried that solution on a workstation running v17.3.5 of Visual Studio 2022 and Intel Fortran 2021.7 and I did NOT get any errors from Visual Studio or Intel Fortran's COM modules or any other component at all, each time it worked as expected.

So if you get errors with the solution in the above zip file, chances are high it is something with installation / setup that may be conflicting or throwing an exception and in which case, uninstalling, cleaning the environment, and reinstalling might be the way to go.  But now if you don't get errors with the the solution in the above zip file after repeated attempts, the issue may be elsewhere with your C# solution or some such.  Just some food for thought with things you can try.

0 Kudos

Thanks. I downloaded it and it worked fine. My problem does not usually occur immediately, so I made changes or just cleaned the build and rebuilt it, and after about a dozen iterations I got the exception.  I am going to try a clean install starting with VS and then Fortran and see if that helps.

Thanks everyone for suggestions.

0 Kudos

I did a complete removal of VS and Fortran and reinstalled fresh. As I understand the instructions, I installed VS with C++ Desktop workflow and then installed Fortran.

Same problem recurred within less than 10 builds later. It occurs on all projects, so I don't think it is project related. Are there components of build, which is where it happens, that are outside the scope of installing VS that might be at fault? 

Appreciate any advice. Otherwise I'll just live with it for a while.

0 Kudos
Black Belt

You may have something goofy in your DLL load path(s) such than an old/incorrect DLL is being loaded. What may be of interest is to determine which DLL's are loaded by VS during build.


You may write your own tool, which will use "debugging" features. This tool must

  1. Start new process suspended
  2. Attach to created process as debugger
  3. Process debugging events, as I remember, you need LOAD_DLL_DEBUG_EVENT


Note, MS VS starts multiple processes:


Note 5 processes. It is unclear as to which one would be throwing the error. Start with the... - Microsoft Visual Studio process.

Jim Dempsey

0 Kudos

I appreciate the advice on this.  FYI, I think the advice that something in my system was messed up was apropos.  I took the opportunity to do a complete clean reinstall of windows and everything, and that seems to have cleaned the problem. There are elements used by Visual Studio/Intel Fortran that are obviously not installed by those packages. I have it back working well now, appreciate all the advice.

0 Kudos