Share via

-1073741819 error code after my c++ application is successfully exit with 0.

JEEDIGAM Sampath K 1 Reputation point
2026-03-18T10:27:08.8566667+00:00

Hi Team,

We are currently facing an issue with our application and would like to check if this could be related to recent updates in Microsoft Office 365.

Scenario:

  • We have a C# WPF application that invokes a C++ executable using Process.

The C++ application completes successfully and returns 0 from the main function.

The C# application reads the exit code and displays messages accordingly.

Issue:

Recently, on multiple Windows machines, the C# application is receiving an exit code of -1073741819 instead of 0.

This issue started occurring without any changes to our codebase (application has been in maintenance mode for months).

Observations:

The C++ executable runs successfully when executed independently.

When invoked from C#, the exit code is incorrect.

After investigation, we found:

Uninstalling Microsoft Office 365 (64-bit) resolves the issue.

Installing Microsoft Office 365 (32-bit) does not cause the issue.

Reinstalling Office 365 (64-bit) brings the issue back.

Ask:

Is there any known issue or recent update in Microsoft Office 365 (64-bit) that could affect process execution or exit codes?

Could there be any dependency, runtime conflict, or system-level change introduced by Office 365 that might cause this behavior?

Any guidance or insights would be greatly appreciated.

Thanks in advance.

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

{count} votes

4 answers

Sort by: Most helpful
  1. Varsha Dundigalla(INFOSYS LIMITED) 4,785 Reputation points Microsoft External Staff
    2026-03-19T12:10:46.76+00:00

    Thank you for reaching out.

    -1073741819 is not a normal “return 0” from your program. It maps to 0xC0000005, which means the C++ process ended because of an access violation (crash). So Windows is reporting that the process crashed, and that is why your C# app sees this exit code.

    From your latest update, the behavior happens only when your C++ code calls ShellExecuteEx. That is a strong sign the crash is happening in the ShellExecuteEx path, not in your normal output logic.

    A key detail is that ShellExecuteEx can hand off work to Shell extensions and COM components. Microsoft notes that COM should be initialized before calling ShellExecuteEx, because some Shell extensions require it.

    So, a practical suggestion is:

    • Make sure COM is initialized in the thread before calling ShellExecuteEx (some Shell extension handlers depend on it).
    • Check Windows Event Viewer > Application logs at the time it happens, because it usually shows the faulting module and confirms where the crash is coming from.

    Also, since you are launching an executable, another safe option is to avoid Shell-based launching if you don’t need file association behavior. ShellExecuteEx is meant for “shell verbs / associations”, and it can involve extra shell components. If you only need to start an exe with arguments and wait for it, using a direct process creation approach (like CreateProcess) avoids shell extensions and can be more predictable. (This is a general recommendation based on how ShellExecuteEx works.)

    References

    Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.


  2. Waigel, Andreas 0 Reputation points
    2026-03-19T11:35:11.08+00:00

    Hi,

    i noticed similar behaviour when starting a new Process of a .net application from another .net application.

    The problem first occurred with Microsoft 365 Update 16.0.19628.20150 and is still present with 16.00.19725.20058.

    With Native Debugging enabled I could track down the source of the Access Violation to Mso98win32client.dll

    Here is probably the same error reported: https://developercommunity.visualstudio.com/t/Error-with-Mso98win32clientdll/11043824?pageSize=15&sort=active

    Our Application ist using the Microsoft Access Driver to connect to a .mdb Database.

    The wrong return code ist provided as soon as the Database Connection is opened.

    0 comments No comments

  3. JEEDIGAM Sampath K 1 Reputation point
    2026-03-19T06:35:57.5566667+00:00

    After i narrow down the problem, if i call below statement, i am getting this error code to C# appliciation.

    // Call the application with argument list.

    bStatus = ShellExecuteEx( &sei );

    There is no issue in my output, but only after my c++ application exited, i am getting this error code to C# application.

    If i stop calling this ShellExecuteEx to launch an exe in C++ application, then i am not getting any error code.

    This is how my code to launch an exe.

    BOOL bStatus = FALSE;

    CString csVerb = _T("open");

    SHELLEXECUTEINFO sei = {0};

    // Set up to launch the application.

    sei.cbSize = sizeof( SHELLEXECUTEINFO );

    sei.fMask = SEE_MASK_NOCLOSEPROCESS;

    sei.lpVerb = _T("open");

    sei.hwnd = hWndParent;

    sei.lpFile = csFilename;

    sei.lpParameters = csArguments;

    // Set up show/hide state

    if ( !bShowGUI )

    {

    // Indicate to the process to NOT display its GUI.
    
    sei.fMask |= SEE_MASK_FLAG_NO_UI;
    
    sei.nShow = SW_HIDE;
    

    }

    // Else:

    else

    {

    // Indicate to the process to show its GUI.
    
    sei.nShow = SW_SHOWMINNOACTIVE;
    

    }

    // Call the application with argument list.

    bStatus = ShellExecuteEx( &sei );

    // If unable to launch the executable:

    if( !bStatus )

    {

    hErrorCode = sei.hInstApp;
    
    return bStatus;
    

    }

    // If waiting for application to finish then capture the exit code

    if ( bWaitForExit )

    {

    dwExitCode	= STILL_ACTIVE;
    
    WaitForSingleObject( sei.hProcess, INFINITE );
    
    GetExitCodeProcess( sei.hProcess, &dwExitCode );
    
    // ShellExecute returns a value > 32 upon success.
    
    if ( (LONG_PTR)( sei.hInstApp ) <= 32 )
    
    {
    
    	hErrorCode = sei.hInstApp;
    
    }
    

    }

    return bStatus;


  4. Q&A Assist
    2026-03-18T10:27:30.9633333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    There is no information in the provided material that indicates a known Microsoft 365/Office 365 (64-bit) update that changes process exit behavior or causes a C++ process that returns 0 to be observed as exiting with -1073741819 when launched from a C# WPF application.

    The only Office-related known issue in the context is specific to Microsoft 365 apps (Word, Excel, Outlook, etc.) crashing on Windows Server 2016 after updating to Version 2412 (Build 18324.20168 or 18324.20190), which is fixed in Version 2412 (Build 18324.20194). That issue is about Office apps themselves crashing and does not mention any impact on unrelated processes’ exit codes or on the Windows process model.

    Similarly, the other referenced items concern:

    • A race condition between ExitProcess() and ExitThread() on Windows 7 / Windows Server 2008 R2.
    • General C/C++ application loading and side‑by‑side assembly issues.
    • Application crashes in Visual C++ runtime DLLs.

    None of these documents describe Office 365 (64‑bit) installing components that change exit codes of arbitrary processes or interfere with how Process.ExitCode is reported in .NET.

    Based on the available information, there is no documented Microsoft 365/Office 365 issue matching the described behavior.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.