docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
129 stars 159 forks source link

EnvelopesApi sync methods dead lock net48 WebForms. Issue since 6.1 version. #399

Closed dandros closed 1 year ago

dandros commented 1 year ago

EnvelopesApi sync methods dead lock net48 WebForms. Issue since 6.1 version.

It looks like GetAwaiter doesn't work well in WebForms.

I confirm that latest console code example works perfectly. However when in WebForms, then EnvelopesApi sync methods are dead on arrival.

I didn't test WebForms Async tricks with EnvelopesApi async methods.

DSDemo-LeandroReis commented 1 year ago

Hello there,

Before we dive in, I need some clarification. Please answer the questions below:

  1. Does this work in previous versions (e.g.: 6.0)?
  2. What is the error message you're getting? Do you have a log?
  3. What exactly do you mean by "However when in WebForms, then EnvelopesApi sync methods are dead on arrival"?

Thanks, Leandro

dandros commented 1 year ago

Please find below answers:

  1. Yes it works fine in previous version 6.0
  2. There is no error message. Or I didn't wait long enough to see the error.. The underlying call to DocuSign API works. Envelope is created. However the method call to EnvelopesApi.CreateEnvelope just never returns.
  3. I mean version 6.2 works fine in net48 Console application. However it doesn't work in net48 ASP.NET Web Forms application. Method call to EnvelopesApi.CreateEnvelope never returns.

I guess the following GetAwaiter() doesn't work in ASP.NET Web Forms.

return CreateEnvelopeAsyncWithHttpInfo(accountId, envelopeDefinition, options) .ConfigureAwait(false) .GetAwaiter() .GetResult();

Special considerations should be taken to use Asynchronous methods in ASP.NET Web Forms. https://learn.microsoft.com/en-us/aspnet/web-forms/overview/performance-and-caching/using-asynchronous-methods-in-aspnet-45

Best regards, Dimitri

kenharris commented 1 year ago

Hello there, could you provide a small code sample that replicates your issue?

dandros commented 1 year ago

WebApplication1.zip

Set your ClientId and ImpersonatedUserID in web.config Put private key file and lorem.pdf in C:\Temp_files

AD-CDI commented 1 year ago

Perhaps the same issue: calling TemplatesApi.Get returns an EnvelopeTemplate in DocuSign.eSign 6.0, but hangs forever in 6.1+ and freezes the UI.

This works fine in a console application, but not in Windows Forms.

Sample code:

            try
            {
                var apiClient = GetRestApiClient();
                var templatesApi = new TemplatesApi(apiClient);
                template = templatesApi.Get(accountId, templateId);                
            }
            catch (ApiException ex)
            {
            }
            catch (Exception ex)
            {
                return ex.Message;
            }

No errors are not caught. Fiddler shows a successful 200 and response with the template JSON.

kenharris commented 1 year ago

Just wanted to provide a quick update on this issue - the team was able to re-produce the issue and is currently looking into a fix.

Welchen commented 1 year ago

We just ran into the same issue with .NET 4.8 synchronous methods and any version of the client over 6.0.

Welchen commented 1 year ago

Just wanted to provide a quick update on this issue - the team was able to re-produce the issue and is currently looking into a fix.

@kenharris any eta on a fix?

kenharris commented 1 year ago

@Welchen I'm not aware of a specific ETA just yet. I'll see what I can find out and report back when I have something more specific.

kenharris commented 1 year ago

A new update was just released moments ago - v6.4.1 - which should have a fix to address this issue.

kenharris commented 1 year ago

I'm going to close this for now. Feel free to re-open if the issue persists, or just open a new issue.