Annotate ThrowTerminatingError
with DoesNotReturn
attribute (#15352)
This commit is contained in:
parent
97ce36ac7f
commit
efdc500ba5
|
@ -672,6 +672,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// Throw terminating error
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
internal void ThrowTerminatingError(Exception exception, string operation)
|
||||
{
|
||||
ErrorRecord errorRecord = new(exception, operation, ErrorCategory.InvalidOperation, this);
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return cmdlet.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
public virtual void ThrowTerminatingError(ErrorRecord errorRecord)
|
||||
{
|
||||
cmdlet.ThrowTerminatingError(errorRecord);
|
||||
|
@ -115,6 +116,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// Throw terminating error
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
internal void ThrowTerminatingError(Exception exception, string operation)
|
||||
{
|
||||
ErrorRecord errorRecord = new(exception, operation, ErrorCategory.InvalidOperation, this);
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
_command = command;
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
internal void ThrowTerminatingError(ErrorRecord errorRecord)
|
||||
{
|
||||
_command.ThrowTerminatingError(errorRecord);
|
||||
|
|
|
@ -230,6 +230,7 @@ namespace System.Management.Automation
|
|||
/// 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)
|
||||
|
|
|
@ -549,6 +549,7 @@ namespace System.Management.Automation
|
|||
/// 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
|
||||
|
|
|
@ -2055,6 +2055,7 @@ namespace System.Management.Automation
|
|||
/// <see cref="System.Management.Automation.Cmdlet.ProcessRecord"/>.
|
||||
/// etc.
|
||||
/// </remarks>
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
public void ThrowTerminatingError(ErrorRecord errorRecord)
|
||||
{
|
||||
ThrowIfStopping();
|
||||
|
|
|
@ -1714,6 +1714,7 @@ namespace System.Management.Automation
|
|||
/// <see cref="System.Management.Automation.Cmdlet.ProcessRecord"/>.
|
||||
/// etc.
|
||||
/// </remarks>
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
public void ThrowTerminatingError(ErrorRecord errorRecord)
|
||||
{
|
||||
using (PSTransactionManager.GetEngineProtectionScope())
|
||||
|
|
|
@ -1417,6 +1417,7 @@ namespace System.Management.Automation.Provider
|
|||
|
||||
#region ThrowTerminatingError
|
||||
/// <Content contentref="System.Management.Automation.Cmdlet.ThrowTerminatingError" />
|
||||
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
|
||||
public void ThrowTerminatingError(ErrorRecord errorRecord)
|
||||
{
|
||||
using (PSTransactionManager.GetEngineProtectionScope())
|
||||
|
|
Loading…
Reference in a new issue