示例#1
0
    unsafe static int Execute(int argc, char **argv, NativeBootstrapperContext *context)
    {
        Logger.TraceInformation($"[{nameof(DomainManager)}] Using CoreCLR");

        // Pack arguments
        var arguments = new string[argc];

        for (var i = 0; i < arguments.Length; i++)
        {
            arguments[i] = new string(argv[i]);
        }

        try
        {
            var bootstrapperContext = new BootstrapperContext();

            bootstrapperContext.OperatingSystem  = new string(context->OperatingSystem);
            bootstrapperContext.OsVersion        = new string(context->OsVersion);
            bootstrapperContext.Architecture     = new string(context->Architecture);
            bootstrapperContext.RuntimeDirectory = new string(context->RuntimeDirectory);
            bootstrapperContext.ApplicationBase  = new string(context->ApplicationBase);
            bootstrapperContext.TargetFramework  = new FrameworkName(FrameworkNames.LongNames.DnxCore, new Version(5, 0));
            bootstrapperContext.RuntimeType      = "CoreClr";

            return(RuntimeBootstrapper.Execute(arguments, bootstrapperContext));
        }
        catch (Exception ex)
        {
            return(ex.HResult != 0 ? ex.HResult : 1);
        }
    }
示例#2
0
    public static int Main(string[] arguments)
    {
        // Set the default lib path to be next to the entry point location
        Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", Path.GetDirectoryName(typeof(EntryPoint).Assembly.Location));
        Environment.SetEnvironmentVariable("KRE_CONSOLE_HOST", "1");

        return(RuntimeBootstrapper.Execute(arguments));
    }
示例#3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            SetupContainer();
            _bootstrapper = new RuntimeBootstrapper(Container, AssemblyToScanProvider.List);
            _bootstrapper.Start();
        }
示例#4
0
    unsafe static int Execute(int argc, char **argv)
    {
        // Pack arguments
        var arguments = new string[argc];

        for (var i = 0; i < arguments.Length; i++)
        {
            arguments[i] = new string(argv[i]);
        }

        return(RuntimeBootstrapper.Execute(arguments));
    }
示例#5
0
    private int Main(int argc, string[] argv)
    {
        // Create the socket on a new thread to warm up the configuration stack
        // before any other code starts to run. This allows us to startup up much
        // faster.
        ThreadPool.UnsafeQueueUserWorkItem(_ =>
        {
            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        },
                                           null);

        return(RuntimeBootstrapper.Execute(argv, _dnxTfm));
    }
示例#6
0
文件: EntryPoint.cs 项目: sanbir/dnx
        public IAwaiter Execute(uint argc, IntPtr argv)
        {
            var pBstrs = (IntPtr *)argv;

            string[] args = new string[argc];
            for (uint i = 0; i < argc; i++)
            {
                IntPtr thisBstr = pBstrs[i];
                if (thisBstr != IntPtr.Zero)
                {
                    args[i] = Marshal.PtrToStringBSTR(thisBstr);
                }
            }

            return(new Awaiter(RuntimeBootstrapper.ExecuteAsync(args)));
        }
示例#7
0
        protected void Application_Start()
        {
            Container = new WindsorContainer();

            // signalR configuration: must appear before everything else
            GlobalHost.DependencyResolver = new CastleWindsorDependencyResolver(Container);
            RouteTable.Routes.MapHubs();

            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            SetupContainer();
            _bootstrapper = new RuntimeBootstrapper(Container, AssemblyToScanProvider.List);
            _bootstrapper.Start();
        }
示例#8
0
文件: EntryPoint.cs 项目: sanbir/dnx
    public static int Main(string[] arguments)
    {
        // Set the default lib path to be next to the entry point location
        Environment.SetEnvironmentVariable(EnvironmentNames.DefaultLib, Path.GetDirectoryName(typeof(EntryPoint).Assembly.Location));
        Environment.SetEnvironmentVariable(EnvironmentNames.ConsoleHost, "1");

        arguments = ExpandCommandLineArguments(arguments);

        // Set application base dir
        var appbaseIndex = arguments.ToList().FindIndex(arg =>
                                                        string.Equals(arg, "--appbase", StringComparison.OrdinalIgnoreCase));

        if (appbaseIndex >= 0 && (appbaseIndex < arguments.Length - 1))
        {
            Environment.SetEnvironmentVariable(EnvironmentNames.AppBase, arguments[appbaseIndex + 1]);
        }

        return(RuntimeBootstrapper.Execute(arguments));
    }
示例#9
0
文件: EntryPoint.cs 项目: voloda/dnx
    public static int Main(string[] arguments)
    {
        // Check for the debug flag before doing anything else
        bool hasDebugWaitFlag = arguments.Any(arg => string.Equals(arg, "--debug", StringComparison.OrdinalIgnoreCase));

        if (hasDebugWaitFlag)
        {
            if (!Debugger.IsAttached)
            {
                Process currentProc = Process.GetCurrentProcess();
                Console.WriteLine("Process Id: {0}", currentProc.Id);
                Console.WriteLine("Waiting for the debugger to attach...");

                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(250);
                }

                Console.WriteLine("Debugger attached.");
            }
        }

        // Set the default lib path to be next to the entry point location
        Environment.SetEnvironmentVariable(EnvironmentNames.DefaultLib, Path.GetDirectoryName(typeof(EntryPoint).Assembly.Location));
        Environment.SetEnvironmentVariable(EnvironmentNames.ConsoleHost, "1");

        arguments = ExpandCommandLineArguments(arguments);

        // Set application base dir
        var appbaseIndex = arguments.ToList().FindIndex(arg =>
                                                        string.Equals(arg, "--appbase", StringComparison.OrdinalIgnoreCase));

        if (appbaseIndex >= 0 && (appbaseIndex < arguments.Length - 1))
        {
            Environment.SetEnvironmentVariable(EnvironmentNames.AppBase, arguments[appbaseIndex + 1]);
        }

        return(RuntimeBootstrapper.Execute(arguments));
    }
示例#10
0
    unsafe static int Execute(int argc, char **argv)
    {
        Logger.TraceInformation($"[{nameof(DomainManager)}] Using CoreCLR");

        // Pack arguments
        var arguments = new string[argc];

        for (var i = 0; i < arguments.Length; i++)
        {
            arguments[i] = new string(argv[i]);
        }

        try
        {
            return(RuntimeBootstrapper.Execute(
                       arguments,
                       new FrameworkName(FrameworkNames.LongNames.DnxCore, new Version(5, 0))));
        }
        catch (Exception ex)
        {
            return(ex.HResult != 0 ? ex.HResult : 1);
        }
    }
示例#11
0
    public static int Main(string[] arguments)
    {
        // Check for the debug flag before doing anything else
        bool hasDebugWaitFlag = false;

        for (var i = 0; i < arguments.Length; ++i)
        {
            //anything without - or -- is appbase or non-dnx command
            if (arguments[i][0] != '-')
            {
                break;
            }
            if (arguments[i] == "--appbase")
            {
                //skip path argument
                ++i;
                continue;
            }
            if (arguments[i] == "--debug")
            {
                hasDebugWaitFlag = true;
                break;
            }
        }

        if (hasDebugWaitFlag)
        {
            if (!Debugger.IsAttached)
            {
                Process currentProc = Process.GetCurrentProcess();
                Console.WriteLine("Process Id: {0}", currentProc.Id);
                Console.WriteLine("Waiting for the debugger to attach...");

                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(250);
                }

                Console.WriteLine("Debugger attached.");
            }
        }

        // Set the default lib path to be next to the entry point location
        Environment.SetEnvironmentVariable(EnvironmentNames.DefaultLib, Path.GetDirectoryName(typeof(EntryPoint).Assembly.Location));
        Environment.SetEnvironmentVariable(EnvironmentNames.ConsoleHost, "1");

        var p = Environment.OSVersion.Platform;

        if (p != PlatformID.MacOSX && p != PlatformID.Unix)
        {
            Environment.SetEnvironmentVariable(EnvironmentNames.DnxIsWindows, "1");
        }

        arguments = ExpandCommandLineArguments(arguments);

        // Set application base dir
        var appbaseIndex = arguments.ToList().FindIndex(arg =>
                                                        string.Equals(arg, "--appbase", StringComparison.OrdinalIgnoreCase));

        if (appbaseIndex >= 0 && (appbaseIndex < arguments.Length - 1))
        {
            Environment.SetEnvironmentVariable(EnvironmentNames.AppBase, arguments[appbaseIndex + 1]);
        }

        return(RuntimeBootstrapper.Execute(arguments,
                                           // NOTE(anurse): Mono is always "dnx451" (for now).
                                           new FrameworkName("DNX", new Version(4, 5, 1))));
    }
示例#12
0
 private int Main(int argc, string[] argv)
 {
     return(RuntimeBootstrapper.Execute(argv));
 }
示例#13
0
    public static int Main(string[] arguments)
    {
        // Check for the debug flag before doing anything else
        bool hasDebugWaitFlag = false;

        for (var i = 0; i < arguments.Length; ++i)
        {
            //anything without - or -- is appbase or non-dnx command
            if (arguments[i][0] != '-')
            {
                break;
            }
            if (arguments[i] == "--appbase")
            {
                //skip path argument
                ++i;
                continue;
            }
            if (arguments[i] == "--debug")
            {
                hasDebugWaitFlag = true;
                break;
            }
        }

        if (hasDebugWaitFlag)
        {
            if (!Debugger.IsAttached)
            {
                Process currentProc = Process.GetCurrentProcess();
                Console.WriteLine("Process Id: {0}", currentProc.Id);
                Console.WriteLine("Waiting for the debugger to attach...");

                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(250);
                }

                Console.WriteLine("Debugger attached.");
            }
        }

        arguments = ExpandCommandLineArguments(arguments);

        // Set application base dir
        var appbaseIndex = arguments.ToList().FindIndex(arg =>
                                                        string.Equals(arg, "--appbase", StringComparison.OrdinalIgnoreCase));

        var appBase = appbaseIndex >= 0 && (appbaseIndex < arguments.Length - 1)
                ? arguments[appbaseIndex + 1]
                : Directory.GetCurrentDirectory();

        string operatingSystem, osVersion, architecture;

        GetOsDetails(out operatingSystem, out osVersion, out architecture);

        var bootstrapperContext = new BootstrapperContext
        {
            OperatingSystem  = operatingSystem,
            OsVersion        = osVersion,
            Architecture     = architecture,
            RuntimeDirectory = Path.GetDirectoryName(typeof(EntryPoint).Assembly.Location),
            ApplicationBase  = appBase,
            // NOTE(anurse): Mono is always "dnx451" (for now).
            TargetFramework = new FrameworkName("DNX", new Version(4, 5, 1)),
            RuntimeType     = "Mono"
        };

        return(RuntimeBootstrapper.Execute(arguments, bootstrapperContext));
    }