本文整理汇总了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;
}
}
}
示例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
}
示例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;
}
}
}
示例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);
}
}
}
}