Skip to content

Fixed asjob issue caused by view feature in v4 #1492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions powershell/cmdlets/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export class CmdletClass extends Class {
const $this = this;
const lengthFunc = $this.state.project.fixedArray ? 'Length' : 'Count';
const listToArrayFunc = $this.state.project.fixedArray ? '.ToArray()' : '';
if ($this.state.project.autoSwitchView) {
if ($this.state.project.autoSwitchView && !$this.operation.asjob) {
if (isEnumerable) {
return function* () {
yield If(`null != ${valueName}`, function* () {
Expand Down Expand Up @@ -643,7 +643,7 @@ export class CmdletClass extends Class {
}

// switch view property
if (this.state.project.autoSwitchView) {
if (this.state.project.autoSwitchView && !this.operation.asjob) {
this.AddSwitchViewProperty(dotnet.Object);
}

Expand All @@ -663,7 +663,7 @@ export class CmdletClass extends Class {
this.add(new Method('EndProcessing', dotnet.Void, { access: Access.Protected, override: Modifier.Override, description: 'Performs clean-up after the command execution' })).add(
function* () {
// gs01: remember what you were doing here to make it so these can be parallelized...
if ($this.state.project.autoSwitchView) {
if ($this.state.project.autoSwitchView && !$this.operation.asjob) {
yield $this.FlushResponse();
}
if (!$this.state.project.azure) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ public partial class InvokeAzAppComplianceAutomationDownloadSnapshot_Download :
/// <summary>A dictionary to carry over additional data for pipeline.</summary>
private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>();

/// <summary>A buffer to record first returned object in response.</summary>
private object _firstResponse = null;

/// <summary>
/// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object.
/// Two means multiple returned objects in response.
/// </summary>
private int _responseSize = 0;

/// <summary>when specified, runs this cmdlet as a PowerShell job</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")]
[global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)]
Expand Down Expand Up @@ -242,11 +233,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets.Invoke
/// <summary>Performs clean-up after the command execution</summary>
protected override void EndProcessing()
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse);
}
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
if (telemetryInfo != null)
{
Expand Down Expand Up @@ -562,24 +548,7 @@ protected override void StopProcessing()
// onOk - response for 200 / application/json
// (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IDownloadResponse
var result = (await response);
if (null != result)
{
if (0 == _responseSize)
{
_firstResponse = result;
_responseSize = 1;
}
else
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());
}
WriteObject(result.AddMultipleTypeNameIntoPSObject());
_responseSize = 2;
}
}
WriteObject(result, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ public partial class InvokeAzAppComplianceAutomationDownloadSnapshot_DownloadExp
/// <summary>A dictionary to carry over additional data for pipeline.</summary>
private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>();

/// <summary>A buffer to record first returned object in response.</summary>
private object _firstResponse = null;

/// <summary>
/// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object.
/// Two means multiple returned objects in response.
/// </summary>
private int _responseSize = 0;

/// <summary>when specified, runs this cmdlet as a PowerShell job</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")]
[global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)]
Expand Down Expand Up @@ -265,11 +256,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets.Invoke
/// <summary>Performs clean-up after the command execution</summary>
protected override void EndProcessing()
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse);
}
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
if (telemetryInfo != null)
{
Expand Down Expand Up @@ -586,24 +572,7 @@ protected override void StopProcessing()
// onOk - response for 200 / application/json
// (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IDownloadResponse
var result = (await response);
if (null != result)
{
if (0 == _responseSize)
{
_firstResponse = result;
_responseSize = 1;
}
else
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());
}
WriteObject(result.AddMultipleTypeNameIntoPSObject());
_responseSize = 2;
}
}
WriteObject(result, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ public partial class InvokeAzAppComplianceAutomationDownloadSnapshot_DownloadVia
/// <summary>A dictionary to carry over additional data for pipeline.</summary>
private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>();

/// <summary>A buffer to record first returned object in response.</summary>
private object _firstResponse = null;

/// <summary>
/// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object.
/// Two means multiple returned objects in response.
/// </summary>
private int _responseSize = 0;

/// <summary>when specified, runs this cmdlet as a PowerShell job</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")]
[global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)]
Expand Down Expand Up @@ -220,11 +211,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets.Invoke
/// <summary>Performs clean-up after the command execution</summary>
protected override void EndProcessing()
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse);
}
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
if (telemetryInfo != null)
{
Expand Down Expand Up @@ -557,24 +543,7 @@ protected override void StopProcessing()
// onOk - response for 200 / application/json
// (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IDownloadResponse
var result = (await response);
if (null != result)
{
if (0 == _responseSize)
{
_firstResponse = result;
_responseSize = 1;
}
else
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());
}
WriteObject(result.AddMultipleTypeNameIntoPSObject());
_responseSize = 2;
}
}
WriteObject(result, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ public partial class InvokeAzAppComplianceAutomationDownloadSnapshot_DownloadVia
/// <summary>A dictionary to carry over additional data for pipeline.</summary>
private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>();

/// <summary>A buffer to record first returned object in response.</summary>
private object _firstResponse = null;

/// <summary>
/// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object.
/// Two means multiple returned objects in response.
/// </summary>
private int _responseSize = 0;

/// <summary>when specified, runs this cmdlet as a PowerShell job</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")]
[global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)]
Expand Down Expand Up @@ -243,11 +234,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets.Invoke
/// <summary>Performs clean-up after the command execution</summary>
protected override void EndProcessing()
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse);
}
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
if (telemetryInfo != null)
{
Expand Down Expand Up @@ -580,24 +566,7 @@ protected override void StopProcessing()
// onOk - response for 200 / application/json
// (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IDownloadResponse
var result = (await response);
if (null != result)
{
if (0 == _responseSize)
{
_firstResponse = result;
_responseSize = 1;
}
else
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());
}
WriteObject(result.AddMultipleTypeNameIntoPSObject());
_responseSize = 2;
}
}
WriteObject(result, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ public partial class InvokeAzAppComplianceAutomationDownloadSnapshot_DownloadVia
/// <summary>A dictionary to carry over additional data for pipeline.</summary>
private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>();

/// <summary>A buffer to record first returned object in response.</summary>
private object _firstResponse = null;

/// <summary>
/// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object.
/// Two means multiple returned objects in response.
/// </summary>
private int _responseSize = 0;

/// <summary>when specified, runs this cmdlet as a PowerShell job</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")]
[global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)]
Expand Down Expand Up @@ -235,11 +226,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets.Invoke
/// <summary>Performs clean-up after the command execution</summary>
protected override void EndProcessing()
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse);
}
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
if (telemetryInfo != null)
{
Expand Down Expand Up @@ -569,24 +555,7 @@ protected override void StopProcessing()
// onOk - response for 200 / application/json
// (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IDownloadResponse
var result = (await response);
if (null != result)
{
if (0 == _responseSize)
{
_firstResponse = result;
_responseSize = 1;
}
else
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());
}
WriteObject(result.AddMultipleTypeNameIntoPSObject());
_responseSize = 2;
}
}
WriteObject(result, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ public partial class InvokeAzAppComplianceAutomationDownloadSnapshot_DownloadVia
/// <summary>A dictionary to carry over additional data for pipeline.</summary>
private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>();

/// <summary>A buffer to record first returned object in response.</summary>
private object _firstResponse = null;

/// <summary>
/// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object.
/// Two means multiple returned objects in response.
/// </summary>
private int _responseSize = 0;

/// <summary>when specified, runs this cmdlet as a PowerShell job</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")]
[global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)]
Expand Down Expand Up @@ -258,11 +249,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets.Invoke
/// <summary>Performs clean-up after the command execution</summary>
protected override void EndProcessing()
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse);
}
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
if (telemetryInfo != null)
{
Expand Down Expand Up @@ -592,24 +578,7 @@ protected override void StopProcessing()
// onOk - response for 200 / application/json
// (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IDownloadResponse
var result = (await response);
if (null != result)
{
if (0 == _responseSize)
{
_firstResponse = result;
_responseSize = 1;
}
else
{
if (1 ==_responseSize)
{
// Flush buffer
WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());
}
WriteObject(result.AddMultipleTypeNameIntoPSObject());
_responseSize = 2;
}
}
WriteObject(result, false);
}
}
}
Expand Down
Loading
Loading