Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No parameterless constructor definied for type 'SMSApi.Api.Response.Status' #39

Open
Poiu19 opened this issue Apr 7, 2024 · 4 comments

Comments

@Poiu19
Copy link

Poiu19 commented Apr 7, 2024

Logs:
gymmanager2-app-v1.0.0 | fail: GymManagerBackend.Middleware.ErrorHandlingMiddleware[0] gymmanager2-app-v1.0.0 | No parameterless constructor defined for type 'SMSApi.Api.Response.Status'. gymmanager2-app-v1.0.0 | System.MissingMethodException: No parameterless constructor defined for type 'SMSApi.Api.Response.Status'. gymmanager2-app-v1.0.0 | at System.RuntimeType.CreateInstanceOfT() gymmanager2-app-v1.0.0 | at System.Activator.CreateInstance[T]() gymmanager2-app-v1.0.0 | at SMSApi.Api.Action.Base'1.Deserialize[TT](Stream data) gymmanager2-app-v1.0.0 | at SMSApi.Api.Action.Base'1.ResponseToObject(Stream data) gymmanager2-app-v1.0.0 | at SMSApi.Api.Action.Base'1.ProcessResponse(Stream data) gymmanager2-app-v1.0.0 | at SMSApi.Api.Action.Base'1.ExecuteAsync() gymmanager2-app-v1.0.0 | at GymManagerBackend.Services.SMSService.SendSMS(String[] to, String message) in C:\Users\User\source\repos\GymManagerBackend\Services\SMSService.cs:line 37 gymmanager2-app-v1.0.0 | at GymManagerBackend.Services.SMSService.SendSMSToConcreteNumber(String phoneNumber, String message) in C:\Users\User\source\repos\GymManagerBackend\Services\SMSService.cs:line 262 gymmanager2-app-v1.0.0 | at GymManagerBackend.Controllers.SMSController.SendToConcreteNumber(SendSMSToConcreteNumberDto sendToConcreteNumberDto) in C:\Users\User\source\repos\GymManagerBackend\Controllers\SMSController.cs:line 23 gymmanager2-app-v1.0.0 | at lambda_method21(Closure, Object) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask'1 actionResultValueTask) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) gymmanager2-app-v1.0.0 | at GymManagerBackend.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Users\User\source\repos\GymManagerBackend\Middleware\ErrorHandlingMiddleware.cs:line 12

Code:
private async Task<SMSReplyDto> SendSMS(string[] to, string message) { to = to.Distinct().ToArray(); var reply = new SMSReplyDto { UniqueRecipents = to.Length }; IClient smsAPIClient = new ClientOAuth(appSettings.SMSAPIToken); var smsAPIFactory = new SMSFactory(smsAPIClient, new ProxyHTTP("https://api.smsapi.pl/")); var sms = await smsAPIFactory.ActionSend().SetTo(to).SetText(message).ExecuteAsync(); reply.SentSMS = sms.Count; return reply; }

The error is thrown in ExecuteAsync() method. Probably it is because of private constructor of Status: https://github.com/smsapi/smsapi-csharp-client/blob/master/smsapi/Api/Response/Status.cs
I changed this in the local build (version 3.0) and this error no longer occurs, but then I receive information about a problem with the SSL certificate
gymmanager2-app-v1.0.0 | Failed to get response from sms.do gymmanager2-app-v1.0.0 | SMSApi.Api.ProxyException: Failed to get response from sms.do gymmanager2-app-v1.0.0 | ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. gymmanager2-app-v1.0.0 | ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot gymmanager2-app-v1.0.0 | at System.Net.Security.SslStream.SendAuthResetSignal(ReadOnlySpan'1 alert, ExceptionDispatchInfo exception) gymmanager2-app-v1.0.0 | at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions) gymmanager2-app-v1.0.0 | at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | --- End of inner exception stack trace --- gymmanager2-app-v1.0.0 | at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem) gymmanager2-app-v1.0.0 | at System.Threading.Tasks.TaskCompletionSourceWithCancellation'1.WaitWithCancellationAsync(CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) gymmanager2-app-v1.0.0 | at SMSApi.Api.NativeHttpClientHelper.SendRequest(HttpClient httpClient, RequestMethod method, String uri, NameValueCollection body, Dictionary'2 files, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at SMSApi.Api.ProxyHTTP.ExecuteAsync(String uri, NameValueCollection data, Dictionary'2 files, RequestMethod method, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | --- End of inner exception stack trace --- gymmanager2-app-v1.0.0 | at SMSApi.Api.ProxyHTTP.ExecuteAsync(String uri, NameValueCollection data, Dictionary'2 files, RequestMethod method, CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at SMSApi.Api.Action.Action'1.ExecuteAsync(CancellationToken cancellationToken) gymmanager2-app-v1.0.0 | at GymManagerBackend.Services.SMSService.SendSMS(String[] to, String message) in C:\Users\User\source\repos\GymManagerBackend\Services\SMSService.cs:line 48 gymmanager2-app-v1.0.0 | at GymManagerBackend.Services.SMSService.SendSMSToConcreteNumber(String phoneNumber, String message) in C:\Users\User\source\repos\GymManagerBackend\Services\SMSService.cs:line 275 gymmanager2-app-v1.0.0 | at GymManagerBackend.Controllers.SMSController.SendToConcreteNumber(SendSMSToConcreteNumberDto sendToConcreteNumberDto) in C:\Users\User\source\repos\GymManagerBackend\Controllers\SMSController.cs:line 23 gymmanager2-app-v1.0.0 | at lambda_method21(Closure, Object) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask'1 actionResultValueTask) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) gymmanager2-app-v1.0.0 | at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) gymmanager2-app-v1.0.0 | at GymManagerBackend.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Users\User\source\repos\GymManagerBackend\Middleware\ErrorHandlingMiddleware.cs:line 12

@mpawikowski
Copy link
Collaborator

Hello,

Forwarded to our IT department.

@jakublabno
Copy link
Collaborator

Hi, certificate is valid, have you tried to clear you cert storage?
dotnet dev-certs https --clean
dotnet dev-certs https --trust

@Poiu19
Copy link
Author

Poiu19 commented Apr 10, 2024

Hi,
I solved problem with cert by installing it in my docker image.
The only problem is nie parameterless private constructor of Status class. In local build, if I change it to public everything works. Please, fix it and publish in official release build

@jakublabno
Copy link
Collaborator

jakublabno commented Apr 10, 2024

Great to hear, we've fixed this in 3.x version, will also apply patch to the previous version. Thanks for your feedback.

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

No branches or pull requests

3 participants