public static void Initialize(IntPtr context, IntPtr exception) { try { DebugMessage("CoreCLREmbedding::Initialize (CLR) - Starting"); RuntimeEnvironment = new EdgeRuntimeEnvironment(Marshal.PtrToStructure <EdgeBootstrapperContext>(context)); Project project; Project.TryGetProject(RuntimeEnvironment.ApplicationDirectory, out project); ApplicationHostContext = new ApplicationHostContext { ProjectDirectory = RuntimeEnvironment.ApplicationDirectory, TargetFramework = TargetFrameworkName, Project = project }; ApplicationEnvironment = new ApplicationEnvironment(ApplicationHostContext.Project, TargetFrameworkName, "Release", null); LoadContextAccessor = new EdgeAssemblyLoadContextAccessor(); EdgeServiceProvider serviceProvider = new EdgeServiceProvider(); serviceProvider.Add(typeof(IRuntimeEnvironment), RuntimeEnvironment); serviceProvider.Add(typeof(IApplicationEnvironment), ApplicationEnvironment); serviceProvider.Add(typeof(IAssemblyLoadContextAccessor), LoadContextAccessor); CallContextServiceLocator.Locator = new EdgeServiceProviderLocator { ServiceProvider = serviceProvider }; PlatformServices.SetDefault(PlatformServices.Create(null, ApplicationEnvironment, RuntimeEnvironment, null, LoadContextAccessor, null)); DebugMessage("CoreCLREmbedding::Initialize (CLR) - Complete"); } catch (Exception e) { DebugMessage("CoreCLREmbedding::Initialize (CLR) - Exception was thrown: {0}", e.Message); V8Type v8Type; Marshal.WriteIntPtr(exception, MarshalCLRToV8(e, out v8Type)); } }
public static void Initialize(IntPtr context, IntPtr exception) { try { DebugMessage("CoreCLREmbedding::Initialize (CLR) - Starting"); RuntimeEnvironment = new EdgeRuntimeEnvironment(Marshal.PtrToStructure<EdgeBootstrapperContext>(context)); Project project; Project.TryGetProject(RuntimeEnvironment.ApplicationDirectory, out project); ApplicationHostContext = new ApplicationHostContext { ProjectDirectory = RuntimeEnvironment.ApplicationDirectory, TargetFramework = TargetFrameworkName, Project = project }; ApplicationEnvironment = new ApplicationEnvironment(ApplicationHostContext.Project, TargetFrameworkName, "Release", null); LoadContextAccessor = new EdgeAssemblyLoadContextAccessor(); EdgeServiceProvider serviceProvider = new EdgeServiceProvider(); serviceProvider.Add(typeof(IRuntimeEnvironment), RuntimeEnvironment); serviceProvider.Add(typeof(IApplicationEnvironment), ApplicationEnvironment); serviceProvider.Add(typeof(IAssemblyLoadContextAccessor), LoadContextAccessor); CallContextServiceLocator.Locator = new EdgeServiceProviderLocator { ServiceProvider = serviceProvider }; PlatformServices.SetDefault(PlatformServices.Create(null, ApplicationEnvironment, RuntimeEnvironment, null, LoadContextAccessor, null)); DebugMessage("CoreCLREmbedding::Initialize (CLR) - Complete"); } catch (Exception e) { DebugMessage("CoreCLREmbedding::Initialize (CLR) - Exception was thrown: {0}", e.Message); V8Type v8Type; Marshal.WriteIntPtr(exception, MarshalCLRToV8(e, out v8Type)); } }