/// <summary> /// Execute. /// </summary> internal void Execute(PSDataCollectionStream <ErrorRecord> errorStream) { Action <ErrorRecord> writeErrorAction = null; // If error-stream is null or we are in pushed-runspace - then write error directly to console. if (errorStream == null || IsRunspacePushed(_clientHost)) { writeErrorAction = delegate(ErrorRecord errorRecord) { try { if (_clientHost.UI != null) { _clientHost.UI.WriteErrorLine(errorRecord.ToString()); } } catch (Exception e) { // Catch-all OK, 3rd party callout. CommandProcessorBase.CheckForSevereException(e); } }; } // Otherwise write it to error-stream. else { writeErrorAction = delegate(ErrorRecord errorRecord) { errorStream.Write(errorRecord); }; } this.Execute(writeErrorAction); }
/// <summary> /// Execute void. /// </summary> internal void ExecuteVoid(Action <ErrorRecord> writeErrorAction) { try { _remoteHostCall.ExecuteVoidMethod(_clientHost); } catch (Exception exception) { // Catch-all OK, 3rd party callout. CommandProcessorBase.CheckForSevereException(exception); // Extract inner exception. if (exception.InnerException != null) { exception = exception.InnerException; } // Create an error record and write it to the stream. ErrorRecord errorRecord = new ErrorRecord( exception, PSRemotingErrorId.RemoteHostCallFailed.ToString(), ErrorCategory.InvalidArgument, _remoteHostCall.MethodName); writeErrorAction(errorRecord); } }
public Type GetReflectionType() { if (this._cachedType == null) { Type genericType = this.GetGenericType(this.TypeName.GetReflectionType()); if ((genericType != null) && genericType.ContainsGenericParameters) { Type[] source = (from arg in this.GenericArguments select arg.GetReflectionType()).ToArray <Type>(); if (source.Any <Type>(t => t == null)) { return(null); } try { Type type2 = genericType.MakeGenericType(source); Interlocked.CompareExchange <Type>(ref this._cachedType, type2, null); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } } return(this._cachedType); }
protected void OpenHelper() { try { PSEtwLog.SetActivityIdForCurrentThread(this.InstanceId); Runspace item = this.CreateRunspace(); this.pool.Push(item); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); this.SetStateToBroken(exception); throw; } bool flag = false; lock (this.syncObject) { if (this.stateInfo.State == RunspacePoolState.Opening) { this.stateInfo = new System.Management.Automation.RunspacePoolStateInfo(RunspacePoolState.Opened, null); flag = true; } } if (flag) { this.RaiseStateChangeEvent(this.stateInfo); } }
/// <summary> /// Parse ps command using script block. /// </summary> private PSCommand ParsePsCommandUsingScriptBlock(string line, bool?useLocalScope) { try { // Extract execution context from local runspace. Runspace localRunspace = _runspaceRef.OldValue; ExecutionContext context = localRunspace.ExecutionContext; // This is trusted input as long as we're in FullLanguage mode bool isTrustedInput = (localRunspace.ExecutionContext.LanguageMode == PSLanguageMode.FullLanguage); // Create PowerShell from ScriptBlock. ScriptBlock scriptBlock = ScriptBlock.Create(context, line); PowerShell powerShell = scriptBlock.GetPowerShell(context, isTrustedInput, useLocalScope, null); return(powerShell.Commands); } catch (ScriptBlockToPowerShellNotSupportedException e) { CommandProcessorBase.CheckForSevereException(e); } catch (System.Management.Automation.RuntimeException e) { CommandProcessorBase.CheckForSevereException(e); } // If parsing failed return null. return(null); }
/// <summary> /// Execute non void method on object. /// </summary> private RemoteHostResponse ExecuteNonVoidMethodOnObject(object instance) { // Create variables to store result of execution. Exception exception = null; object returnValue = null; // Invoke the method and store its return values. try { if (MethodId == RemoteHostMethodId.GetBufferContents) { throw new PSRemotingDataStructureException(RemotingErrorIdStrings.RemoteHostGetBufferContents, _computerName.ToUpper()); } returnValue = MyMethodBase.Invoke(instance, Parameters); } catch (Exception e) { // Catch-all OK, 3rd party callout. CommandProcessorBase.CheckForSevereException(e); exception = e.InnerException; } // Create a RemoteHostResponse object to store the return value and exceptions. return(new RemoteHostResponse(_callId, MethodId, returnValue, exception)); }
internal static string FormatField(FieldFormattingDirective directive, object val, int enumerationLimit, StringFormatError formatErrorObject, MshExpressionFactory expressionFactory) { PSObject so = AsPSObject(val); if ((directive != null) && !string.IsNullOrEmpty(directive.formatString)) { try { if (directive.formatString.Contains("{0") || directive.formatString.Contains("}")) { return(string.Format(CultureInfo.CurrentCulture, directive.formatString, new object[] { so })); } return(so.ToString(directive.formatString, null)); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); if (formatErrorObject != null) { formatErrorObject.sourceObject = so; formatErrorObject.exception = exception; formatErrorObject.formatString = directive.formatString; return(""); } } } return(SmartToString(so, expressionFactory, enumerationLimit, formatErrorObject)); }
private void PrepareRunspace(Runspace runspace) { string promptFn = StringUtil.Format(RemotingErrorIdStrings.EnterPSHostProcessPrompt, @"function global:prompt { """, @"$($PID)", @"PS $($executionContext.SessionState.Path.CurrentLocation)> "" }" ); // Set prompt in pushed named pipe runspace. using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create()) { ps.Runspace = runspace; try { // Set pushed runspace prompt. ps.AddScript(promptFn).Invoke(); } catch (Exception e) { // Ignore all non-severe errors. CommandProcessorBase.CheckForSevereException(e); } } }
internal static Type ResolveAssemblyQualifiedTypeName(TypeName typeName, out Exception exception) { // If an assembly name was specified, we let Type.GetType deal with loading the assembly // and resolving the type. exception = null; try { // We shouldn't really bother looking for the type in System namespace, but // we've always done that. We explicitly are not supporting arbitrary // 'using namespace' here because there is little value, if you need the assembly // qualifier, it's best to just fully specify the type. var result = Type.GetType(typeName.FullName, false, true) ?? Type.GetType("System." + typeName.FullName, false, true); if (result != null && IsPublic(result)) { return(result); } } catch (Exception e) { CommandProcessorBase.CheckForSevereException(e); exception = e; } return(null); }
private void DisposeCommands() { this.stopping = true; this.FlushLog(); if (this._commands != null) { for (int i = 0; i < this._commands.Count; i++) { CommandProcessorBase base2 = this._commands[i]; if (base2 != null) { try { base2.CommandRuntime.RemoveVariableListsInPipe(); base2.Dispose(); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); InvocationInfo myInvocation = null; if (base2.Command != null) { myInvocation = base2.Command.MyInvocation; } ProviderInvocationException innerException = exception as ProviderInvocationException; if (innerException != null) { exception = new CmdletProviderInvocationException(innerException, myInvocation); } else { exception = new CmdletInvocationException(exception, myInvocation); MshLog.LogCommandHealthEvent(base2.Command.Context, exception, Severity.Warning); } this.RecordFailure(exception, base2.Command); } } } } this._commands = null; if (this._redirectionPipes != null) { foreach (PipelineProcessor processor in this._redirectionPipes) { try { if (processor != null) { processor.Dispose(); } } catch (Exception exception3) { CommandProcessorBase.CheckForSevereException(exception3); } } } this._redirectionPipes = null; }
private static Type LookForTypeInAssemblies(TypeName typeName, IEnumerable <Assembly> assemblies, TypeResolutionState typeResolutionState, bool reportAmbiguousException, out Exception exception) { exception = null; string alternateNameToFind = typeResolutionState.GetAlternateTypeName(typeName.Name); Type foundType = null; Type foundType2 = null; foreach (Assembly assembly in assemblies) { try { Type targetType = LookForTypeInSingleAssembly(assembly, typeName.Name);; if (targetType == null && alternateNameToFind != null) { targetType = LookForTypeInSingleAssembly(assembly, alternateNameToFind); } if (targetType != null) { if (!reportAmbiguousException) { // accelerator for the common case, when we are not interested in ambiguity exception. return(targetType); } // .NET has forward notation for types, when they declared in one assembly and implemented in another one. // We want to support both scenarios: // 1) When we pass assembly with declared forwarded type (CoreCLR) // 2) When we pass assembly with declared forwarded type and assembly with implemented forwarded type (FullCLR) // In the case (2) we should not report duplicate, hence this check if (foundType != targetType) { if (foundType != null) { foundType2 = targetType; break; } else { foundType = targetType; } } } } catch (Exception e) // Assembly.GetType might throw unadvertised exceptions { CommandProcessorBase.CheckForSevereException(e); } } if (foundType2 != null) { exception = new AmbiguousTypeException(typeName, new String[] { foundType.AssemblyQualifiedName, foundType2.AssemblyQualifiedName }); return(null); } return(foundType); }
/// <summary> /// End Processing /// </summary> protected override void EndProcessing() { // Check for host that supports interactive remote sessions. _interactiveHost = this.Host as IHostSupportsInteractiveSession; if (_interactiveHost == null) { WriteError( new ErrorRecord( new ArgumentException(RemotingErrorIdStrings.HostDoesNotSupportIASession), "EnterPSHostProcessHostDoesNotSupportIASession", ErrorCategory.InvalidArgument, null)); return; } // Check selected process for existence, and whether it hosts PowerShell. switch (ParameterSetName) { case ProcessIdParameterSet: Process = GetProcessById(Id); break; case ProcessNameParameterSet: Process = GetProcessByName(Name); break; case PSHostProcessInfoParameterSet: Process = GetProcessByHostProcessInfo(HostProcessInfo); break; } VerifyProcess(Process); // Create named pipe runspace for selected process and open. Runspace namedPipeRunspace = CreateNamedPipeRunspace(Process.Id, AppDomainName); // Set runspace prompt. The runspace is closed on pop so we don't // have to reverse this change. PrepareRunspace(namedPipeRunspace); try { // Push runspace onto host. _interactiveHost.PushRunspace(namedPipeRunspace); } catch (Exception e) { CommandProcessorBase.CheckForSevereException(e); namedPipeRunspace.Close(); ThrowTerminatingError( new ErrorRecord( e, "EnterPSHostProcessCannotPushRunspace", ErrorCategory.InvalidOperation, this)); } }
// Create a new command in the shell context. internal void CreateCommand( IntPtr pluginContext, WSManNativeApi.WSManPluginRequest requestDetails, int flags, string commandLine, WSManNativeApi.WSManCommandArgSet arguments) { try { // inbound cmd information is already verified.. so no need to verify here. WSManPluginCommandTransportManager serverCmdTransportMgr = new WSManPluginCommandTransportManager(transportMgr); serverCmdTransportMgr.Initialize(); // Apply quota limits on the command transport manager _remoteSession.ApplyQuotaOnCommandTransportManager(serverCmdTransportMgr); WSManPluginCommandSession mgdCmdSession = new WSManPluginCommandSession(requestDetails, serverCmdTransportMgr, _remoteSession); AddToActiveCmdSessions(mgdCmdSession); mgdCmdSession.SessionClosed += new EventHandler <EventArgs>(this.HandleCommandSessionClosed); mgdCmdSession.shutDownContext = new WSManPluginOperationShutdownContext( pluginContext, creationRequestDetails.unmanagedHandle, mgdCmdSession.creationRequestDetails.unmanagedHandle, false); do { if (!mgdCmdSession.ProcessArguments(arguments)) { WSManPluginInstance.ReportOperationComplete( requestDetails, WSManPluginErrorCodes.InvalidArgSet, StringUtil.Format( RemotingErrorIdStrings.WSManPluginInvalidArgSet, "WSManPluginCommand")); break; } // Report plugin context to WSMan mgdCmdSession.ReportContext(); } while (false); } catch (System.Exception e) { CommandProcessorBase.CheckForSevereException(e); // if there is an exception creating remote session send the message to client. WSManPluginInstance.ReportOperationComplete( requestDetails, WSManPluginErrorCodes.ManagedException, StringUtil.Format( RemotingErrorIdStrings.WSManPluginManagedException, e.Message)); } }
private string ValidateComputerNames(string computer) { IPAddress pAddress = null; string str; string str1 = null; if (computer.Equals(".", StringComparison.OrdinalIgnoreCase) || computer.Equals("localhost", StringComparison.OrdinalIgnoreCase) || computer.Equals(this._shortLocalMachineName, StringComparison.OrdinalIgnoreCase) || computer.Equals(this._fullLocalMachineName, StringComparison.OrdinalIgnoreCase)) { str1 = "localhost"; } else { bool flag = false; try { flag = IPAddress.TryParse(computer, out pAddress); } catch (Exception exception1) { Exception exception = exception1; CommandProcessorBase.CheckForSevereException(exception); } try { string hostName = Dns.GetHostEntry(computer).HostName; if (hostName.Equals(this._shortLocalMachineName, StringComparison.OrdinalIgnoreCase) || hostName.Equals(this._fullLocalMachineName, StringComparison.OrdinalIgnoreCase)) { str1 = "localhost"; } else { str1 = computer; } return(str1); } catch (Exception exception3) { Exception exception2 = exception3; CommandProcessorBase.CheckForSevereException(exception2); if (flag) { str1 = computer; return(str1); } else { string str2 = StringUtil.Format(ComputerResources.CannotResolveComputerName, computer, exception2.Message); ErrorRecord errorRecord = new ErrorRecord(new InvalidOperationException(str2), "AddressResolutionException", ErrorCategory.InvalidArgument, computer); base.WriteError(errorRecord); str = null; } } return(str); } return(str1); }
/// <summary> /// Raises events for changes in execution state. /// </summary> protected void RaisePipelineStateEvents() { Queue <ExecutionEventQueueItem> tempEventQueue = null; EventHandler <PipelineStateEventArgs> stateChanged = null; bool runspaceHasAvailabilityChangedSubscribers = false; lock (SyncRoot) { stateChanged = this.StateChanged; runspaceHasAvailabilityChangedSubscribers = _runspace.HasAvailabilityChangedSubscribers; if (stateChanged != null || runspaceHasAvailabilityChangedSubscribers) { tempEventQueue = _executionEventQueue; _executionEventQueue = new Queue <ExecutionEventQueueItem>(); } else { //Clear the events if there are no EventHandlers. This //ensures that events do not get called for state //changes prior to their registration. _executionEventQueue.Clear(); } } if (tempEventQueue != null) { while (tempEventQueue.Count > 0) { ExecutionEventQueueItem queueItem = tempEventQueue.Dequeue(); if (runspaceHasAvailabilityChangedSubscribers && queueItem.NewRunspaceAvailability != queueItem.CurrentRunspaceAvailability) { _runspace.RaiseAvailabilityChangedEvent(queueItem.NewRunspaceAvailability); } // this is shipped as part of V1. So disabling the warning here. #pragma warning disable 56500 //Exception rasied in the eventhandler are not error in pipeline. //silently ignore them. if (stateChanged != null) { try { stateChanged(this, new PipelineStateEventArgs(queueItem.PipelineStateInfo)); } catch (Exception exception) // ignore non-severe exceptions { CommandProcessorBase.CheckForSevereException(exception); } } #pragma warning restore 56500 } } }
private void CloseThreadProc() { try { this.DoCloseHelper(); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } }
internal void ServicePendingCallbacks(object objectToProcess) { tracer.WriteLine("ServicePendingCallbacks thread is starting", new object[0]); PSEtwLog.ReplaceActivityIdForCurrentThread(this.runspacePoolInstanceId, PSEventId.OperationalTransferEventRunspacePool, PSEventId.AnalyticTransferEventRunspacePool, PSKeyword.Transport, PSTask.None); try { while (!this.isClosed) { CallbackNotificationInformation information = null; lock (this.callbackNotificationQueue) { if ((this.callbackNotificationQueue.Count <= 0) || this.suspendQueueServicing) { return; } information = this.callbackNotificationQueue.Dequeue(); } if (information != null) { if (information.transportError != null) { this.RaiseErrorHandler(information.transportError); return; } if (information.privateData != null) { this.ProcessPrivateData(information.privateData); } else { base.OnDataAvailableCallback(information.remoteObject); } } } } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); tracer.WriteLine(string.Format(CultureInfo.InvariantCulture, "Exception processing data. {0}", new object[] { exception.Message }), new object[0]); PSRemotingTransportException e = new PSRemotingTransportException(exception.Message, exception); TransportErrorOccuredEventArgs eventArgs = new TransportErrorOccuredEventArgs(e, TransportMethodEnum.ReceiveShellOutputEx); this.RaiseErrorHandler(eventArgs); } finally { lock (this.callbackNotificationQueue) { tracer.WriteLine("ServicePendingCallbacks thread is exiting", new object[0]); this.isServicingCallbacks = false; this.EnqueueAndStartProcessingThread(null, null, null); } } }
public static bool IsWinSqmOptedIn() { try { return(WinSQMWrapper.WinSqmIsOptedIn()); } catch (Exception ex) { CommandProcessorBase.CheckForSevereException(ex); } return(false); }
/// <summary> /// Commits the current transaction /// </summary> protected override void EndProcessing() { using (CurrentPSTransaction) { try { var emptyArray = Utils.EmptyArray <object>(); _transactedScript.InvokeUsingCmdlet( contextCmdlet: this, useLocalScope: false, errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe, dollarUnder: null, input: emptyArray, scriptThis: AutomationNull.Value, args: emptyArray); } catch (Exception e) { // Catch-all OK. This is a third-party call-out. CommandProcessorBase.CheckForSevereException(e); ErrorRecord errorRecord = new ErrorRecord(e, "TRANSACTED_SCRIPT_EXCEPTION", ErrorCategory.NotSpecified, null); // The "transaction timed out" exception is // exceedingly obtuse. We clarify things here. bool isTimeoutException = false; Exception tempException = e; while (tempException != null) { if (tempException is System.TimeoutException) { isTimeoutException = true; break; } tempException = tempException.InnerException; } if (isTimeoutException) { errorRecord = new ErrorRecord( new InvalidOperationException( TransactionResources.TransactionTimedOut), "TRANSACTION_TIMEOUT", ErrorCategory.InvalidOperation, e); } WriteError(errorRecord); } } }
private void HandleSessionClosed(object sender, RemoteDataEventArgs <Exception> eventArgs) { RunspacePoolState state; RunspacePoolStateInfo info; if (eventArgs.Data != null) { this.closingReason = eventArgs.Data; } lock (base.syncObject) { state = base.stateInfo.State; switch (state) { case RunspacePoolState.Opening: case RunspacePoolState.Opened: case RunspacePoolState.Disconnecting: case RunspacePoolState.Disconnected: case RunspacePoolState.Connecting: this.SetRunspacePoolState(new RunspacePoolStateInfo(RunspacePoolState.Broken, this.closingReason)); break; case RunspacePoolState.Closing: this.SetRunspacePoolState(new RunspacePoolStateInfo(RunspacePoolState.Closed, this.closingReason)); break; } info = new RunspacePoolStateInfo(base.stateInfo.State, base.stateInfo.Reason); } try { base.RaiseStateChangeEvent(info); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } switch (state) { case RunspacePoolState.Disconnecting: case RunspacePoolState.Disconnected: this.SetDisconnectAsCompleted(); break; default: if (state == RunspacePoolState.Connecting) { this.SetReconnectAsCompleted(); } break; } this.SetCloseAsCompleted(); }
private void OnOutputDataReceived(object sender, DataReceivedEventArgs e) { try { OutOfProcessUtils.ProcessData(e.Data, this.dataProcessingCallbacks); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); PSRemotingTransportException exception2 = new PSRemotingTransportException(PSRemotingErrorId.IPCErrorProcessingServerData, RemotingErrorIdStrings.IPCErrorProcessingServerData, new object[] { exception.Message }); this.RaiseErrorHandler(new TransportErrorOccuredEventArgs(exception2, TransportMethodEnum.ReceiveShellOutputEx)); } }
internal void ServicePendingCallbacks(object objectToProcess) { BaseClientTransportManager.tracer.WriteLine("ServicePendingCallbacks thread is starting", new object[0]); BaseTransportManager.ETWTracer.ReplaceActivityIdForCurrentThread(this.runspacePoolInstanceId, PSEventId.OperationalTransferEventRunspacePool, PSEventId.AnalyticTransferEventRunspacePool, PSKeyword.Transport, PSTask.None); try { while (!this.isClosed) { BaseClientTransportManager.ReceivedDataInformation receivedDataInformation = (BaseClientTransportManager.ReceivedDataInformation)null; lock (this.callbackNotificationQueue) { if (this.callbackNotificationQueue.Count <= 0) { break; } receivedDataInformation = this.callbackNotificationQueue.Dequeue(); } if (receivedDataInformation != null) { if (receivedDataInformation.transportException != null) { this.RaiseErrorHandler(new TransportErrorOccuredEventArgs(receivedDataInformation.transportException, TransportMethodEnum.ReceiveShellOutputEx)); break; } if (receivedDataInformation.privateData != null) { this.ProcessPrivateData(receivedDataInformation.privateData); } else { this.OnDataAvailableCallback(receivedDataInformation.remoteObject); } } } } catch (Exception ex) { CommandProcessorBase.CheckForSevereException(ex); BaseClientTransportManager.tracer.WriteLine(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Exception processing data. {0}", (object)ex.Message), new object[0]); this.RaiseErrorHandler(new TransportErrorOccuredEventArgs(new PSRemotingTransportException(ex.Message), TransportMethodEnum.ReceiveShellOutputEx)); } finally { lock (this.callbackNotificationQueue) { BaseClientTransportManager.tracer.WriteLine("ServicePendingCallbacks thread is exiting", new object[0]); this.isServicingCallbacks = false; this.EnqueueAndStartProcessingThread((RemoteDataObject <PSObject>)null, (PSRemotingTransportException)null, (object)null); } } }
public static void NoteSessionConfigurationIdleTimeout(int idleTimeout) { if (isWinSQMEnabled) { try { WinSQMWrapper.WinSqmAddToStream(0x209f, idleTimeout.ToString(CultureInfo.InvariantCulture)); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } }
public static void NoteSessionConfigurationOutputBufferingMode(string optBufferingMode) { if (isWinSQMEnabled) { try { WinSQMWrapper.WinSqmAddToStream(0x20b8, optBufferingMode); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } }
private void CoreInvoke(IEnumerable input, bool syncCall) { using (PipelineBase._trace.TraceMethod()) { lock (this.SyncRoot) { if (this._disposed) { throw PipelineBase._trace.NewObjectDisposedException("pipeline"); } if (this.Commands == null || this.Commands.Count == 0) { throw PipelineBase._trace.NewInvalidOperationException("Runspace", "NoCommandInPipeline"); } if (this.PipelineState != PipelineState.NotStarted) { InvalidPipelineStateException pipelineStateException = new InvalidPipelineStateException(ResourceManagerCache.FormatResourceString("Runspace", "PipelineReInvokeNotAllowed"), this.PipelineState, PipelineState.NotStarted); PipelineBase._trace.TraceException((Exception)pipelineStateException); throw pipelineStateException; } if (syncCall) { if (input != null) { foreach (object obj in input) { this._inputStream.Write(obj); } } this._inputStream.Close(); } this._syncInvokeCall = syncCall; this._pipelineFinishedEvent = new ManualResetEvent(false); this.RunspaceBase.DoConcurrentCheckAndAddToRunningPipelines(this, syncCall); this.SetPipelineState(PipelineState.Running); } try { this.StartPipelineExecution(); } catch (Exception ex) { CommandProcessorBase.CheckForSevereException(ex); PipelineBase._trace.TraceException(ex); this.RunspaceBase.RemoveFromRunningPipelineList(this); this.SetPipelineState(PipelineState.Failed, ex); throw; } } }
public static void NoteWorkflowOutputStreamSize(int size, string streamType) { if (isWinSQMEnabled) { try { WinSQMWrapper.WinSqmAddToStream(0x269a, streamType, size); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } }
public static void NoteWorkflowEndpointConfiguration(string quotaName, int data) { if (isWinSQMEnabled) { try { WinSQMWrapper.WinSqmAddToStream(0x2699, quotaName, data); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } }
public static void NoteWorkflowCommonParametersValues(string parameterName, int data) { if (isWinSQMEnabled) { try { WinSQMWrapper.WinSqmAddToStream(0x268d, parameterName, data); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } }
internal bool ItemExists(string path, CmdletProviderContext context) { base.Context = context; bool flag = false; try { flag = this.ItemExists(path); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } return(flag); }
private static string SafeToString(object obj) { if (obj != null) { try { return(obj.ToString()); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); } } return(""); }