Example #1
0
        /// <summary>
        /// Installs an assembly resolver that delegates to the creating <see cref="AppDomain" />'s
        /// assembly resolver to locate assemblies whenever the host is unable to find them.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Does nothing if the host is local.
        /// </para>
        /// <para>
        /// This hook is useful for testing but should not be used in production code.
        /// </para>
        /// </remarks>
        /// <param name="host">The host.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="host"/> is null.</exception>
        public static void InstallCallback(IHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            if (!host.IsLocal)
            {
                Resolver remoteResolver = HostUtils.CreateInstance <Resolver>(host);
                remoteResolver.InstallCallback(LocalResolver);
            }
        }
Example #2
0
        /// <summary>
        /// Installs an assembly resolver that provides access to the installation path
        /// using the <see cref="AssemblyLoaderBootstrap" />.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Does nothing if the host is local.
        /// </para>
        /// <para>
        /// This hook is recommended for newly created domains.
        /// </para>
        /// </remarks>
        /// <param name="host">The host.</param>
        /// <param name="runtimePath">The Gallio runtime path.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="host"/> or
        /// <paramref name="runtimePath" /> is null.</exception>
        public static void Bootstrap(IHost host, string runtimePath)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (runtimePath == null)
            {
                throw new ArgumentNullException("runtimePath");
            }

            if (!host.IsLocal)
            {
                Resolver remoteResolver = HostUtils.CreateInstance <Resolver>(host);
                remoteResolver.Bootstrap(runtimePath);
            }
        }