Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information

Hi,

after calling ctlDoc.OpenDocument, ctlDoc.InternalError contains the error “Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information”. I’m now looking for a way that I can get the LoaderExceptions property

Thanks,
Daniel

@dcassaralpert,

Thank you for reaching out. To better assist you, could you please provide the following information:

  1. Which version of .NET are you currently using? (.NET Framework, .NET Standard/Core or .NET 6)
  2. Could you also specify the version of Doconut you are using?
  3. Additionally, could you please send the example file where the error occurs?

Once we have this information, I will be able to provide you with the appropriate assistance.

Thanks for your help!

Good morning,

apologies for the delay in my reply. please find my replies below:

  1. We are using .NET Framework 4.8
  2. We are currently on 25.8
  3. I am not able to get you a specific file as this is happening in our client’s live environment, however the issue is not specific to a particular document.

NB: This issue is only happening at one client and is not happening on our test and dev environments or any other client so far. It would seem like this error should be caught by your code to provide further info like a missing library file or something.

I am also attaching screenshots of errors in event viewer when this error occurs.
image (2).png (114.6 KB)

image (1).png (105.1 KB)

image.png (103.9 KB)

@dcassaralpert

Thank you for sharing the screenshots. Unfortunately, the screenshots you sent us don’t show the line of code or the specific location where the exception occurs.

If you can, creating a simple project with all this configuration will help us replicate the problem exactly and help resolve it.

It would also be helpful to provide the web.config file (to check assembly bindings and configuration).

Without this information, it’s not possible to reproduce the problem or determine the exact cause.

@gabriel.vega

I don’t think a demo app will be of any help, as I mentioned this is simply happening when calling ctlDoc.OpenDocument and it is only happening at 1 client, all other clients and locally it all works fine without any issues and we are using same versions, same libraries, same web.config, so the issue is not from code or web.config etc. in my opinion.

What would be helpful for this is if you actually capture the ‘LoaderExceptions’ in your library so that you will be able to return the required information regarding what file is causing the issue within ctlDoc.InternalError. eg:

catch (ReflectionTypeLoadException ex)
{
    exceptionmessage = ex.Message;

    // Iterate through the specific exceptions
    foreach (Exception loaderEx in ex.LoaderExceptions)
    {
        exceptionmessage += $"\nLoader Exception: {loaderEx.Message}";

        // For missing files, you can often get more detail via FusionLog
        if (loaderEx is FileNotFoundException fileNotFoundEx)
        {
            exceptionmessage += $"\nMissing File/Assembly: {fileNotFoundEx.FileName}";
            // Fusion Log can provide a detailed binding trace (if enabled)
            if (!string.IsNullOrEmpty(fileNotFoundEx.FusionLog))
            {
                exceptionmessage += $"\nFusion Log: {fileNotFoundEx.FusionLog}";
            }
        }
    }
}

@dcassaralpert

Since the issue only occurs in your client’s environment and not locally or with other customers, we currently have no way to reproduce the error on our end.

Additionally, from a support standpoint, we still need as much contextual information as possible to analyze this properly — including:

  • The web.config file (to review assembly bindings and version redirects)
  • The list of NuGet package versions being used
  • Any custom deployment details (IIS version, .NET version, hosting setup, etc.)

Without this information, it’s unfortunately not possible to replicate the problem or determine the exact root cause.