smsapi / smsapi-csharp-client

SMSAPI C# client that allows you to send messages and administrate your SMSAPI account.
https://www.smsapi.com/
29 stars 20 forks source link

New version of RestSharp #32

Closed tomaszlis86 closed 1 year ago

tomaszlis86 commented 1 year ago

On 13.03.2023 was released new version of RestSharp (109.0.1) with changes to the RestClient and RestClientOptions. This results in errors in ProxyHTTP.cs. In lines 60, 101 - BuildUri method is no longer public on RestClient. In line 145 - Authenticator has been moved from RestClient to RestClientOptions.

As for BuildUri there is discussion going, however as I see, it probably won't be accessible if only used for logging purposes. https://github.com/restsharp/RestSharp/issues/2026

mpawikowski commented 1 year ago

Hello,

Thank you for your report, I forwarded it to our IT department.

Best regards, Mateusz Pawikowski

jakublabno commented 1 year ago

@tomaszlis86 They've restored this in version 110, however I don't know if the world is ready to abandon our support for .net 5 - new version of RestSharp requires .net >=6. Maybe I'll find some workaround.

tomaszlis86 commented 1 year ago

Well, if you ever decide to push to newer version of RestSharp, I have discovered some issues with that as well. Currently on version 110.2.0, there is a problem with reading from a stream on response. More or less, it is already closed. Below you have the exception I am getting. I think it is somehow connected with this bug on RestSharp side: https://github.com/restsharp/RestSharp/issues/1822

"Message":"Failed to get response from https://smsapi.io/sms.do","Data":{},"InnerException":{"ClassName":"System.ObjectDisposedException","Message":"Cannot access a closed Stream.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.IO.MemoryStream.Read(Byte[] buffer, Int32 offset, Int32 count)\n at System.IO.MemoryStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken)\n--- End of stack trace from previous location ---\n at RestSharp.Extensions.StreamExtensions.ReadAsBytes(Stream input, CancellationToken cancellationToken)\n at RestSharp.RestResponse.<>c__DisplayClass0_0.<<FromHttpResponse>g__GetDefaultResponse|0>d.MoveNext()\n--- End of stack trace from previous location ---\n at RestSharp.RestResponse.<>c__DisplayClass0_0.<<FromHttpResponse>g__GetDefaultResponse|0>d.MoveNext()\n--- End of stack trace from previous location ---\n at RestSharp.RestResponse.FromHttpResponse(HttpResponseMessage httpResponse, RestRequest request, Encoding encoding, CookieCollection cookieCollection, CalculateResponseStatus calculateResponseStatus, CancellationToken cancellationToken)\n at RestSharp.RestClient.ExecuteAsync(RestRequest request, CancellationToken cancellationToken)\n at SMSApi.Api.ProxyHTTP.ExecuteAsync(String uri, NameValueCollection data, Dictionary2 files, RequestMethod method) in $$$sourcepath$$$\smsapi\ProxyHTTP.cs:line 97","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146232798,"Source":"System.Private.CoreLib","WatsonBuckets":null,"ObjectName":""},"HelpLink":null,"Source":"CommunicationService","HResult":-2146233088,"StackTrace":" at SMSApi.Api.ProxyHTTP.ExecuteAsync(String uri, NameValueCollection data, Dictionary2 files, RequestMethod method) in $$$sourcepath$$$\\smsapi\\ProxyHTTP.cs:line 101\n at SMSApi.Api.Action.Base1.ExecuteAsync() in $$$sourcepath$$$\smsapi\Api\Action\Base.cs:line 28\n

jakublabno commented 1 year ago

Hello, please check new version which uses newer RestSharp (109.0.1) library, as per my tests, everything works well - https://www.nuget.org/packages/SMSAPI.pl/2.2.0