Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8508883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:17:03+00:00 2026-06-11T03:17:03+00:00

I am calling a .NET assembly from C++. This works perfectly for any test

  • 0

I am calling a .NET assembly from C++.

This works perfectly for any test .NET 4.0 projects that I call.

However, when calling a large project with 20 sub-assemblies, it fails with the error below:

Failed to execute assembly: 0x80004003. GetLastError=126. dwReturn=1.

Here is the C++ code that generates the error:

DWORD dwReturn;
hr = pCLR->ExecuteInDefaultAppDomain(szApplication, szEntryType, szEntryMethod, szParameter, &dwReturn);
if (FAILED(hr))
{
    // Fails if I try the production assembly, with 20 subassemblies.
    printf("    Failed to execute assembly: 0x%X. GetLastError=%d. dwReturn=%d.\n", hr, GetLastError(), dwReturn);
}
else
{
    // Works 100% if I plug in a small toy assembly in .NET 4.0.
    wprintf(L"    Assembly returned: %d\n", dwReturn);
}

Environment

  • Visual Studio 2010 SP1.
  • C++ for the code above.
  • .NET 4.0 for the target assembly.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:17:04+00:00Added an answer on June 11, 2026 at 3:17 am

    Your managed code died with a NullReferenceException. Its Exception.HResult value is 0x80004003, E_POINTER.

    Clearly that’s a very common reason for managed code to die. In the transition from managed code back to native code, you’ll lose a lot of context for the exception. That puts a burden on the managed code to do some essential error logging, at least the all-mighty Exception.StackTrace. The .NET 4 AppDomain.FirstChanceException event can be useful.

    Debug the problem by enabling managed code debugging, Project + Properties, Debugging, Debugger Type = Mixed. And Debug + Exceptions, Thrown checkbox for CLR exceptions so the debugger stops the program when the exception is thrown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

from flex, when calling a .net web method that returns a custom class, I
I'm having trouble with a .NET Assembly that is com visible, and calling certain
I am calling asp.net action from proxy to fill the store data. I am
When calling an ASP.Net PageMethod, we call it as follows: function doSomething(htmlElement) { PageMethods.GetText(onSuccess,
I am calling an ASP.NET MVC action public JsonResult GetPatient(string patientID) { ... from
Can anyone help? I have an issue with calling a asp.net webservice from jquery..
This question follows on from Assembly does not allow partially trusted callers when using
I have a Powershell script that is loading a .NET assembly (.EXE in my
There are two assemblies: 1) Assembly containing serializer. This is a place from where
1) A call to PInvoke function 'PDFjet!PDFjet.NET.OptionalDeflateStream::compress' has unbalanced the stack. This is likely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.