Skip to content

Commit a387de8

Browse files
authored
Revert special assembly loading for MongoDB (#4730)
it reverts #3668 no longer needed as we do not have direct dependency on any MongoDB package - ref #3845
1 parent 0ce3d54 commit a387de8

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

src/OpenTelemetry.AutoInstrumentation.Loader/AssemblyResolver.NetFramework.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,6 @@ internal partial class AssemblyResolver
3030

3131
_logger.Debug("Requester [{0}] requested [{1}]", args.RequestingAssembly?.FullName ?? "<null>", args.Name ?? "<null>");
3232

33-
// All MongoDB* are signed and does not follow https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/versioning#assembly-version
34-
// There is no possibility to automatically redirect from 2.28.0 to 2.29.0.
35-
// Loading assembly and ignoring this version.
36-
if (assemblyName.StartsWith("MongoDB", StringComparison.OrdinalIgnoreCase) &&
37-
(string.Equals(assemblyName, "MongoDB.Driver.Core", StringComparison.OrdinalIgnoreCase) ||
38-
string.Equals(assemblyName, "MongoDB.Bson", StringComparison.OrdinalIgnoreCase) ||
39-
string.Equals(assemblyName, "MongoDB.Libmongocrypt", StringComparison.OrdinalIgnoreCase)))
40-
{
41-
try
42-
{
43-
var mongoAssembly = Assembly.Load(assemblyName);
44-
_logger.Debug<string, bool>("Assembly.Load(\"{0}\") succeeded={1}", assemblyName, mongoAssembly != null);
45-
return mongoAssembly;
46-
}
47-
catch (Exception ex)
48-
{
49-
_logger.Debug(ex, "Assembly.Load(\"{0}\") Exception: {1}", assemblyName, ex.Message);
50-
}
51-
52-
return null;
53-
}
54-
5533
var path = Path.Combine(Path.GetDirectoryName(_managedProfilerDirectory) ?? _managedProfilerDirectory, $"{assemblyName}.dll");
5634
if (!File.Exists(path))
5735
{

0 commit comments

Comments
 (0)