private static Assembly? ResolveOpenTelemetryEngineAssembly()

in src/AzureFunctions.PowerShell.OpenTelemetry.SDK/AssemblyLoadContext/ModuleInitializer.cs [63:78]


        private static Assembly? ResolveOpenTelemetryEngineAssembly(
            AssemblyLoadContext assemblyLoadContext,
            AssemblyName assemblyName)
        {
            // We only want to resolve the OpenTelemetryEngine.dll assembly, which will be loaded into
            // the custom ALC.
            if (assemblyName.Name is not null && !assemblyName.Name.Equals("OpenTelemetryEngine"))
            {
                return null;
            }

            // We load the OpenTelemetry Engine assembly through the Dependency ALC, the context in which
            // all of its dependencies will be resolved (preventing potential conflicts with the
            // PowerShell worker's dependencies).
            return singletonALC.LoadFromAssemblyName(assemblyName);
        }