当前位置: 首页>>代码示例>>C#>>正文


C# ExecutionContext.ReportEngineStartupError方法代码示例

本文整理汇总了C#中ExecutionContext.ReportEngineStartupError方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutionContext.ReportEngineStartupError方法的具体用法?C# ExecutionContext.ReportEngineStartupError怎么用?C# ExecutionContext.ReportEngineStartupError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExecutionContext的用法示例。


在下文中一共展示了ExecutionContext.ReportEngineStartupError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bind

 internal void Bind(ExecutionContext executionContext)
 {
     this._host = executionContext.EngineHostInterface;
     this.Initialize(executionContext);
     this.Assemblies.OnUpdate += new RunspaceConfigurationEntryUpdateEventHandler(executionContext.UpdateAssemblyCache);
     runspaceInitTracer.WriteLine("initializing assembly list", new object[0]);
     try
     {
         this.Assemblies.Update(true);
     }
     catch (RuntimeException exception)
     {
         runspaceInitTracer.WriteLine("assembly list initialization failed", new object[0]);
         MshLog.LogEngineHealthEvent(executionContext, 0x67, exception, Severity.Error);
         executionContext.ReportEngineStartupError(exception.Message);
         throw;
     }
     if (executionContext.CommandDiscovery != null)
     {
         this.Cmdlets.OnUpdate += new RunspaceConfigurationEntryUpdateEventHandler(executionContext.CommandDiscovery.UpdateCmdletCache);
         runspaceInitTracer.WriteLine("initializing cmdlet list", new object[0]);
         try
         {
             this.Cmdlets.Update(true);
         }
         catch (PSNotSupportedException exception2)
         {
             runspaceInitTracer.WriteLine("cmdlet list initialization failed", new object[0]);
             MshLog.LogEngineHealthEvent(executionContext, 0x67, exception2, Severity.Error);
             executionContext.ReportEngineStartupError(exception2.Message);
             throw;
         }
     }
     if (executionContext.EngineSessionState != null)
     {
         this.Providers.OnUpdate += new RunspaceConfigurationEntryUpdateEventHandler(executionContext.EngineSessionState.UpdateProviders);
         runspaceInitTracer.WriteLine("initializing provider list", new object[0]);
         try
         {
             this.Providers.Update(true);
         }
         catch (PSNotSupportedException exception3)
         {
             runspaceInitTracer.WriteLine("provider list initialization failed", new object[0]);
             MshLog.LogEngineHealthEvent(executionContext, 0x67, exception3, Severity.Error);
             executionContext.ReportEngineStartupError(exception3.Message);
             throw;
         }
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:50,代码来源:RunspaceConfiguration.cs

示例2: Initialize

        internal void Initialize(ExecutionContext executionContext)
        {
#pragma warning disable 56517

            lock (_syncObject)
            {
                if (!_initialized)
                {
                    _initialized = true;

                    this.Types.OnUpdate += this.UpdateTypes;
                    this.Formats.OnUpdate += this.UpdateFormats;

                    s_runspaceInitTracer.WriteLine("initializing types information");
                    try
                    {
                        this.UpdateTypes();
                    }
                    catch (RuntimeException e)
                    {
                        s_runspaceInitTracer.WriteLine("type information initialization failed");
                        MshLog.LogEngineHealthEvent(
                            executionContext,
                            MshLog.EVENT_ID_CONFIGURATION_FAILURE,
                            e,
                            Severity.Warning);
                        executionContext.ReportEngineStartupError(e.Message);
                    }

                    s_runspaceInitTracer.WriteLine("initializing format information");
                    try
                    {
                        this.UpdateFormats(true);
                    }
                    catch (RuntimeException e)
                    {
                        s_runspaceInitTracer.WriteLine("format information initialization failed");
                        MshLog.LogEngineHealthEvent(
                            executionContext,
                            MshLog.EVENT_ID_CONFIGURATION_FAILURE,
                            e,
                            Severity.Warning);
                        executionContext.ReportEngineStartupError(e.Message);
                    }
                }
            }

#pragma warning restore 56517
        }
开发者ID:40a,项目名称:PowerShell,代码行数:49,代码来源:RunspaceConfiguration.cs

示例3: Bind

        internal void Bind(ExecutionContext executionContext)
        {
            _host = executionContext.EngineHostInterface;

            Initialize(executionContext);

            this.Assemblies.OnUpdate += executionContext.UpdateAssemblyCache;

            s_runspaceInitTracer.WriteLine("initializing assembly list");
            try
            {
                this.Assemblies.Update(true);
            }
            catch (RuntimeException e)
            {
                s_runspaceInitTracer.WriteLine("assembly list initialization failed");
                MshLog.LogEngineHealthEvent(
                    executionContext,
                    MshLog.EVENT_ID_CONFIGURATION_FAILURE,
                    e,
                    Severity.Error);
                executionContext.ReportEngineStartupError(e.Message);

                throw;
            }

            if (executionContext.CommandDiscovery != null)
            {
                this.Cmdlets.OnUpdate += executionContext.CommandDiscovery.UpdateCmdletCache;

                // Force an update here so that cmdlet cache is updated in engine.
                s_runspaceInitTracer.WriteLine("initializing cmdlet list");
                try
                {
                    this.Cmdlets.Update(true);
                }
                catch (PSNotSupportedException e)
                {
                    s_runspaceInitTracer.WriteLine("cmdlet list initialization failed");
                    MshLog.LogEngineHealthEvent(
                        executionContext,
                        MshLog.EVENT_ID_CONFIGURATION_FAILURE,
                        e,
                        Severity.Error);
                    executionContext.ReportEngineStartupError(e.Message);
                    throw;
                }
            }

            if (executionContext.EngineSessionState != null)
            {
                this.Providers.OnUpdate += executionContext.EngineSessionState.UpdateProviders;

                // Force an update here so that provider cache is updated in engine.
                s_runspaceInitTracer.WriteLine("initializing provider list");
                try
                {
                    this.Providers.Update(true);
                }
                catch (PSNotSupportedException e)
                {
                    s_runspaceInitTracer.WriteLine("provider list initialization failed");
                    MshLog.LogEngineHealthEvent(
                        executionContext,
                        MshLog.EVENT_ID_CONFIGURATION_FAILURE,
                        e,
                        Severity.Error);
                    executionContext.ReportEngineStartupError(e.Message);
                    throw;
                }
            }
        }
开发者ID:40a,项目名称:PowerShell,代码行数:72,代码来源:RunspaceConfiguration.cs

示例4: Initialize

 internal void Initialize(ExecutionContext executionContext)
 {
     lock (this._syncObject)
     {
         if (!this._initialized)
         {
             this._initialized = true;
             this.Types.OnUpdate += new RunspaceConfigurationEntryUpdateEventHandler(this.UpdateTypes);
             this.Formats.OnUpdate += new RunspaceConfigurationEntryUpdateEventHandler(this.UpdateFormats);
             runspaceInitTracer.WriteLine("initializing types information", new object[0]);
             try
             {
                 this.UpdateTypes(true);
             }
             catch (RuntimeException exception)
             {
                 runspaceInitTracer.WriteLine("type information initialization failed", new object[0]);
                 MshLog.LogEngineHealthEvent(executionContext, 0x67, exception, Severity.Warning);
                 executionContext.ReportEngineStartupError(exception.Message);
             }
             runspaceInitTracer.WriteLine("initializing format information", new object[0]);
             try
             {
                 this.UpdateFormats(true);
             }
             catch (RuntimeException exception2)
             {
                 runspaceInitTracer.WriteLine("format information initialization failed", new object[0]);
                 MshLog.LogEngineHealthEvent(executionContext, 0x67, exception2, Severity.Warning);
                 executionContext.ReportEngineStartupError(exception2.Message);
             }
         }
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:34,代码来源:RunspaceConfiguration.cs


注:本文中的ExecutionContext.ReportEngineStartupError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。