Skip to content

Conversation

@dolauli
Copy link
Contributor

@dolauli dolauli commented Jul 2, 2020

Reverts #602, since the change break another non-azure user.

And post the issue as below.

Recently we experience problem when Autorest generates additional information inside our partial class autogenerated class Module.cs. In Bold is the diff between working and not working version.

NOT WORKING ( IN Bold)
/****************************************************************************
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
using SignalDelegate = global::System.Func<string, global::System.Threading.CancellationToken, global::System.Funcglobal::System.EventArgs, global::System.Threading.Tasks.Task>;
using EventListenerDelegate = global::System.Func<string, global::System.Threading.CancellationToken, global::System.Funcglobal::System.EventArgs, global::System.Func<string, global::System.Threading.CancellationToken, global::System.Funcglobal::System.EventArgs, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, global::System.Exception, global::System.Threading.Tasks.Task>;

/// <summary>A class that contains the module-common code and data.</summary>
public partial class Module
{
    public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler();

    /// <summary>the ISendAsync pipeline instance</summary>
    private Microsoft.Teams.Config.Cmdlets.Runtime.HttpPipeline _pipeline;

    /// <summary>the ISendAsync pipeline instance (when proxy is enabled)</summary>
    private Microsoft.Teams.Config.Cmdlets.Runtime.HttpPipeline _pipelineWithProxy;

    public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy();

    /// <summary>The instance of the Client API</summary>
    public Microsoft.Teams.Config.Cmdlets.MicrosoftIc3AdminConfigRpPolicy ClientAPI { get; set; }

    /// <summary>A delegate that gets called for each signalled event</summary>
    public EventListenerDelegate EventListener { get; set; }

    /// <summary>Called to dispatch events to the common module listener</summary>
    /// <param name="id">The ID of the event </param>
    /// <param name="token">The cancellation token for the event </param>
    /// <param name="getEventData">A delegate to get the detailed event data</param>
    /// <param name="signal">The callback for the event dispatcher </param>
    /// <param name="invocationInfo">The <see cref="System.Management.Automation.InvocationInfo" /> from the cmdlet</param>
    /// <param name="parameterSetName">the cmdlet's parameterset name.</param>
    /// <param name="exception">the exception that is being thrown (if available)</param>
    /// <returns>
    /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the event is completed.
    /// </returns>

public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Funcglobal::System.EventArgs getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, global::System.Exception exception)
{
using( NoSynchronizationContext )
{
await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName,exception);
}
}

}
}

/****************************************************************************

Working

// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Teams.Config.Cmdlets
{
using static Microsoft.Teams.Config.Cmdlets.Runtime.Extensions;

/// <summary>A class that contains the module-common code and data.</summary>
public partial class Module
{
    public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler();

    /// <summary>the ISendAsync pipeline instance</summary>
    private Microsoft.Teams.Config.Cmdlets.Runtime.HttpPipeline _pipeline;

    /// <summary>the ISendAsync pipeline instance (when proxy is enabled)</summary>
    private Microsoft.Teams.Config.Cmdlets.Runtime.HttpPipeline _pipelineWithProxy;

    public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy();

    /// <summary>The instance of the Client API</summary>
    public Microsoft.Teams.Config.Cmdlets.MicrosoftIc3AdminConfigRpPolicy ClientAPI { get; set; }
}

}

Do you have any insides why this not working code is being generated. The issue is that we are getting null ref executing line await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName,exception);

@dolauli dolauli merged commit 5b06bef into master Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants