If you remove and reinstall the dependencies does it work?
Thanks, but unfortunately that didn’t work. That project has dozens of other dependencies as well. I’ll try to find time to remove them all and test it.
I know the release notes mentions API/Method updates, but there had to have been something else. Was there a dependency update? Was there a change to how Square is called from the SDK?
These are the updates, right? Release Version 25.2.0 · square/square-dotnet-sdk · GitHub
That’s correct. Those are the updates.
Was there a resolution to this freeze/lock issue? I’m experiencing same problem with any version after v25.1.0
Still breaks for me. I need to debug more. It must have to do with config or other DLLs.
I have the exact same problem. I updated from V25.1.0 to V25.2.0 (or anything beyond) and every API call from the SDK hangs. I have the QuickStart working no problem, but my main application does not work. I have even tried to call the client.LocationsApi.ListLocationsAsync() method which needs no parameters other than the access token - no luck.
My code calls the API - I can see that in the Square logs. And I can see in the logs that the API call generated the JSON and returned it. Fiddler shows that the API HTTP call was made, and the response came back. Something happens in the SDK on my local machine where it is attempting to handle the response but never succeeds.
My main applications has dozens of other packages in it - I can’t remove them all and start adding them back one at a time to see what makes it fail.
Is there any way that I can configure Visual Studio to use the source code files when debugging so I can see what might be going on inside the Square package?
What are the other packages you have in your application?
Here is the list of all packages:
We are working to reproduce and figure out the issue you are running into - if you can, please follow these instructions to create a .DMP file.
With this we will be able to analyze the process dump to check the state and line of code where it’s getting stuck.
Once the .DMP file is created, please start a direct message with me, and upload it in that chat. If that doesn’t work, please let me know and we can figure out another way to send the file over.
Hi @Jordan-Square was there ever a resolution to this issue?
We have exactly the same issue, upgrading from 25.1.0 to 26.0.0, any call to Square freezes/locks IIS and VS.
I can create a blank web project with nothing in it except the Square API, debug the application in localhost, make any call to Square and it freezes.
If I use a Windows Console Application upgrading from 25.1.0 to 26.0.0 and above it works correctly so suggests this is some issue running the API on a local web server.
Just an assumption but the library APIMatic.Core was used in the upgrade from 25.1.0 to 26.0.0, could it be something to do with this library?
We don’t have a solution yet as we are still waiting to get more information from users that are having this issue.
Definitely seems like the APIMatic.Core library is culprit here.
If possible can you follow the instructions in my previous message to create
.DMP file while running the code that freezes?
Another possibility is if you can push that blank repo where you have the code freezing to github so we can clone and try and reproduce as well.
It is just a blank web project with the Square library but here is a link to the zip of the project:
I removed our Access Token from the appsettings file but I can message it if needed.
Will look to get the .DMP file as well.
In regards to the sample application code and why the code is freezing. This is because the DotNet-Framework v4.8 has an issue with the synchronization context that needs an intermediate Task to generate a new context to handle exceptions.
wait() is called on the main thread, the work inside the async function is executed on the same main thread. As a result, there is no available main thread to catch an exception. To address this, you can utilize another task,
Task.Run() to encapsulate the work. This way, the responsibility will be shifted to the new Task context.
This line can be updated as so, and it should fix the code from freezing up
It’s also important to note that .NET Core does not have a synchronization context, so you won’t encounter this deadlock issue with .NET Core.
Let me know if you have further questions or if that is not working
You can replace the call with any method, not just an asynchronous call. No method using the API works with. NET 4.8.
Is the API only supporting. NET core going forward? Surely the API itself can wrap methods accordingly so the library supports. NET 4.8?
It’s been months since I’ve had a chance to look at this after my previous posts in July. I see that @Jordan-Square has blamed .NET 4.8 on the freezing problem and suggested a workaround using a second Task context. My code has no asynchronous component to it at all, so I had to jump through a number of hoops to add some obfuscation to my code. I went from this simple line:
CreateOrderResponse response = ordersApi.CreateOrder( createOrderRequest );
Task responseTask = Task.Run( async () => await ordersApi.CreateOrderAsync( createOrderRequest ) );
CreateOrderResponse response = responseTask.Result;
The workaround actually works so I’m not complaining too much. Thanks for the explanation - that helped me figure out what I needed to implement.
However, I have to agree with @pauld. How is it that you’ve gone from 25.2.0 to 33.0.0 and the SDK is still broken?
I’m glad the work around is currently functioning for you, but I do agree this is unacceptable.
Apologies for the delayed reply, but I have good news! I took this feedback to our SDK team once again, and was able to secure effort towards implementing a fix. I’ve just been informed that we have a fix for this, and I will update this thread when that fix is released.
Thank you for your patience on this, and continually giving feedback!
EDIT: Expecting the fix will go out some time after the holidays in January
@Jordan-Square that’s great news, thank you! We haven’t been able to update the SDK in a while as we have so many integration points so this will make things much easier for us
Happy to let you know that the fix for this issue went out with our latest SDK release yesterday. More information here
Please consider upgrading to this version of the SDK and let me know if you run into any other troubles!
I know this is going back a couple of months but thanks for getting this updated. I have had to explain to my client that I could not update NuGet Packages for Square for some time. I just tested multiple points in my client’s custom ERP system to make sure everything works with the new SDK update.