csharp/ABTSoftware/SciChart.Wpf.Examples/Sandbox/WPFChartPerformanceBenchmark/WPFChartPerformanceBenchmark/App.xaml.cs

App.xaml.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;

namespace WPFChartPerformanceBenchmark
{
    /// 
    /// Interaction logic for App.xaml
    /// 
    public partial clast App : Application
    {
        private astembly[] _chartProviderDlls;

        public static App Instance
        {
            get
            {
                return Application.Current as App;
            }
        }

        public App()
        {            
            AppDomain.CurrentDomain.astemblyResolve += (sender, args) =>
            {
                lock (typeof (App))
                {
                    if (_chartProviderDlls == null)
                    {
                        var exeFolder = Path.GetDirectoryName(astembly.GetExecutingastembly().Location);

                        _chartProviderDlls = new DirectoryInfo(exeFolder)
                            .GetFiles("*.dll", SearchOption.AllDirectories)
                            .Select(x => x.FullName)
                            .Where(x => PortableExecutableHelper.IsDotNetastembly(x))
                            .Distinct().Select(x =>
                            {
                                
                                return astembly.LoadFile(x);
                            })
                            .ToArray();
                    }
                }

                var asm = _chartProviderDlls.FirstOrDefault(dll => dll.FullName.Equals(args.Name));

                Debug.WriteLine("Resolving {0}, {1}", args.Name, asm == null ? "NOT FOUND" : "Found " + asm.FullName);

                return asm;
            };
        }
    }
}