Share via

SSIS Job Failing Due to MongoDB Driver Dependency Error After MongoDB 8 Upgrade

Sahar Aitlhou 25 Reputation points
2026-01-06T15:16:26.63+00:00

As part of an ongoing upgrade to MongoDB version 8, we are updating the C# components used to integrate data into MongoDB collections to ensure compatibility with the latest MongoDB driver syntax and APIs.

During this upgrade, we are encountering a runtime failure that causes the SSIS job to crash during execution. The failure occurs within the SSIS Script Component during the pre-execution phase and appears to be related to a missing or incompatible MongoDB dependency.

The following error is thrown at runtime:

System.ApplicationException: Could not load file or assembly 'MongoDB.Driver.Legacy' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER)) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute() at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)

As a result of this error, the SSIS job fails during execution and does not complete successfully.

Environment details:

  • Visual Studio 2022
  • SQL Server 2022
  • MongoDB Server 8.0
  • MongoDB C# Driver 2.13.2
  • .NET Framework 4.7

Any assistance is highly appreciated to identify the root cause of the MongoDB driver dependency issue and determine the correct driver configuration or compatibility requirements for use with SSIS and .NET Framework 4.7.

SQL Server Integration Services
0 comments No comments
{count} votes

Answer accepted by question author and recommended by moderator
  1. Lakshmi Narayana Garikapati 920 Reputation points Microsoft External Staff Moderator
    2026-01-07T06:35:25.6266667+00:00

    Hi Sahar,

    The error you’re seeing (Could not load file or assembly MongoDB.Driver.Legacy) is happening because the legacy MongoDB driver is no longer included or supported in the newer MongoDB C# driver versions. Starting with driver 2.12+, only the unified MongoDB.Driver API is maintained, and MongoDB.Driver.Legacy has been deprecated.

    A few steps that should resolve the issue:

    • Remove Legacy References: Update your SSIS Script Component to remove any references to MongoDB.Driver.Legacy. Replace old API calls (MongoServer, MongoDatabase) with the modern equivalents (MongoClient, IMongoDatabase).
    • Update Driver Packages: Use the latest MongoDB C# driver (2.19 or higher is recommended). Make sure both MongoDB.Driver and MongoDB.Bson assemblies are deployed with SSIS.
    • Target Framework: The MongoDB driver officially supports .NET Framework 4.7.2 and above. Upgrading your Script Component project from 4.7 to 4.7.2 or 4.8 will help avoid binding/runtime issues.
    • Deployment in SSIS: Ensure the correct assemblies are copied to the SSIS runtime environment (either in the GAC or alongside the package).

    Hope this helps!

    Thanks,

    Lakshmi.


0 additional answers

Sort by: Most helpful

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.