Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ internal virtual CmdletOperationBase CmdletOperation
/// Throw terminating error
/// </para>
/// </summary>
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
internal void ThrowTerminatingError(Exception exception, string operation)
{
ErrorRecord errorRecord = new(exception, operation, ErrorCategory.InvalidOperation, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public virtual bool ShouldProcess(string verboseDescription, string verboseWarni
return cmdlet.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason);
}

[System.Diagnostics.CodeAnalysis.DoesNotReturn]
public virtual void ThrowTerminatingError(ErrorRecord errorRecord)
{
cmdlet.ThrowTerminatingError(errorRecord);
Expand Down Expand Up @@ -115,6 +116,7 @@ public virtual void WriteWarning(string text)
/// Throw terminating error
/// </para>
/// </summary>
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
internal void ThrowTerminatingError(Exception exception, string operation)
{
ErrorRecord errorRecord = new(exception, operation, ErrorCategory.InvalidOperation, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ internal TerminatingErrorContext(PSCmdlet command)
_command = command;
}

[System.Diagnostics.CodeAnalysis.DoesNotReturn]
internal void ThrowTerminatingError(ErrorRecord errorRecord)
{
_command.ThrowTerminatingError(errorRecord);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public PSTransactionContext CurrentPSTransaction
/// if it exists, otherwise throw an invalid operation exception.
/// </summary>
/// <param name="errorRecord">The error record to throw.</param>
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
public void ThrowTerminatingError(ErrorRecord errorRecord)
{
if (errorRecord.Exception != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ public interface ICommandRuntime
/// if any information is to be added. It should encapsulate the
/// error record into an exception and then throw that exception.
/// </remarks>
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
void ThrowTerminatingError(ErrorRecord errorRecord);
#endregion ThrowTerminatingError
#endregion misc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2055,6 +2055,7 @@ public PSTransactionContext CurrentPSTransaction
/// <see cref="System.Management.Automation.Cmdlet.ProcessRecord"/>.
/// etc.
/// </remarks>
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
public void ThrowTerminatingError(ErrorRecord errorRecord)
{
ThrowIfStopping();
Expand Down
1 change: 1 addition & 0 deletions src/System.Management.Automation/engine/cmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ public PSTransactionContext CurrentPSTransaction
/// <see cref="System.Management.Automation.Cmdlet.ProcessRecord"/>.
/// etc.
/// </remarks>
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
public void ThrowTerminatingError(ErrorRecord errorRecord)
{
using (PSTransactionManager.GetEngineProtectionScope())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,7 @@ public virtual string GetResourceString(string baseName, string resourceId)

#region ThrowTerminatingError
/// <Content contentref="System.Management.Automation.Cmdlet.ThrowTerminatingError" />
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
public void ThrowTerminatingError(ErrorRecord errorRecord)
{
using (PSTransactionManager.GetEngineProtectionScope())
Expand Down