Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4845

System.IO.FileLoadException: Could not load file or assembly 'MongoDB.Driver.Legacy, Culture=neutral, PublicKeyToken=null'. The process cannot access the file because it is being used by another process

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Unknown Unknown
    • None
    • None
    • None
    • None

    Description

      Summary

      When running parallel tests in multiple processes, tests will randomly fail. (NCrunch)

      System.IO.FileLoadException: Could not load file or assembly 'MongoDB.Driver.Legacy, Culture=neutral, PublicKeyToken=null'. The process cannot access the file because it is being used by another process. (0x80070020)
         at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMarkHandle stackMark, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack type, ObjectHandleOnStack keepalive)
         at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
         at System.Type.GetType(String typeName)
         at MongoDB.Driver.Core.Connections.ClientDocumentHelper.<CreateDriverDocument>gIsLegacyLoaded|6_0()
         at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateDriverDocument(String driverVersion)
         at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateDriverDocument()
         at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
      --- End of stack trace from previous location ---
         at System.Lazy`1.CreateValue()
         at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateClientDocument(String applicationName)
         at MongoDB.Driver.Core.Connections.BinaryConnectionFactory..ctor(ConnectionSettings settings, IStreamFactory streamFactory, IEventSubscriber eventSubscriber, ServerApi serverApi, ILoggerFactory loggerFactory)
         at MongoDB.Driver.Core.Configuration.ClusterBuilder.CreateConnectionPoolFactory()
         at MongoDB.Driver.Core.Configuration.ClusterBuilder.CreateServerFactory()
         at MongoDB.Driver.Core.Configuration.ClusterBuilder.CreateClusterFactory()
         at MongoDB.Driver.ClusterRegistry.CreateCluster(ClusterKey clusterKey)
         at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey)
         at MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings)

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      2.19.2 (standalone, docker).

      How to Reproduce

      Using NCrunch or similar, run tests which will result in the exception, typically within a few seconds. Alternatively churn a single test until failure will result in same.

      Additional Background

      Please provide any additional background information that may be helpful in diagnosing the bug.

      Attachments

        Activity

          People

            adelin.mbidaowona@mongodb.com Adelin Mbida Owona
            dhickey@gmail.com Damian Hickey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: