EasyPost / easypost-csharp

EasyPost Shipping API Client Library for .NET and .NET Framework applications
https://easypost.com/docs/api
MIT License
66 stars 74 forks source link

[Bug]: Calling Dispose on the Client causes a StackOverflowException #587

Closed cargilltay closed 2 months ago

cargilltay commented 2 months ago

Software Version

6.7.2

Language Version

.NET 8

Operating System

Mac Ventura 13.4

What happened?

  1. Create new instance of the Client class exactly as the README example shows.
  2. Call .Dispose().
  3. Note that a StackOverflowException gets thrown.

What was expected?

I'd expect calling Dispose to not loop into a StackOverflowException.

Sample Code

using EasyPost;

namespace Example;

class ExampleClass
{
    static async Task Main()
    {
        var client = new Client(new ClientConfiguration(Environment.GetEnvironmentVariable("EASYPOST_API_KEY")));
        client.Dispose();
    }
}

Relevant logs

Stack overflow.
Repeat 8025 times:                                   
--------------------------------                     
   at EasyPost.Client.Dispose(Boolean)               
   at EasyPost._base.EasyPostClient.Dispose()        
   at EasyPost._base.EasyPostService.Dispose(Boolean)
   at EasyPost._base.EasyPostService.Dispose()       
--------------------------------                     
   at EasyPost.Client.Dispose(Boolean)               
   at EasyPost._base.EasyPostClient.Dispose()        
   at Example.ExampleClass+<Main>d__0.MoveNext()     
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec
85d7bea7798e]](System.__Canon ByRef)
   at Example.ExampleClass.Main()
   at Example.ExampleClass.<Main>()

Process finished with exit code -1,073,741,571.
nwithan8 commented 2 months ago

Thank you for reporting this. We were able to recreate the issue and are working on a fix now.

nwithan8 commented 2 months ago

This has been fixed in v6.7.3.