Web API (backend) - Affiliates/ValidateFriendlyUrlName call failing : 500 server error : "Self referencing loop detected..."

8 months ago
This call is failing even when using the API interface backend to test it:
Example: /api-backend/Affiliates/ValidateFriendlyUrlName/1?friendlyUrlName=new%20name

Even using the swagger UI to test it gives me a 500 error response.

Here is the full error response:
{
  "message": "Self referencing loop detected for property 'Task' with type 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[System.String,Nop.Services.Affiliates.AffiliateService+<ValidateFriendlyUrlNameAsync>d__16]'. Path 'StateMachine.<>t__builder'.",
  "inner_exception_message": null,
  "stack_trace": "Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'Task' with type 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[System.String,Nop.Services.Affiliates.AffiliateService+<ValidateFriendlyUrlNameAsync>d__16]'. Path 'StateMachine.<>t__builder'.\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)\r\n   at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)\r\n   at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)\r\n   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\r\n   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n   at Nop.Services.Authentication.AuthenticationMiddleware.InvokeAsync(HttpContext context) in D:\\TVS_DEVELOPMENT\\Inspire\\Store.Inspire.World.V2\\Source\\Libraries\\Nop.Services\\Authentication\\AuthenticationMiddleware.cs:line 95\r\n   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\\projects\\dotnet\\src\\MiniProfiler.AspNetCore\\MiniProfilerMiddleware.cs:line 121\r\n   at WebMarkupMin.AspNetCore7.WebMarkupMinMiddleware.InvokeCore(HttpContext context, Boolean useMinification, Boolean useCompression)\r\n   at WebMarkupMin.AspNetCore7.WebMarkupMinMiddleware.InvokeCore(HttpContext context, Boolean useMinification, Boolean useCompression)\r\n   at Nop.Plugin.Misc.WebApi.Framework.Middleware.JwtMiddleware.InvokeAsync(HttpContext context, IWorkContext workContext, ICustomerService customerService)\r\n   at Nop.Plugin.Misc.WebApi.Framework.Middleware.ErrorHandlerMiddleware.InvokeAsync(HttpContext context)"
}
8 months ago
Yes, that's right, unfortunately in this method we missed the await instruction before calling the _affiliateService.ValidateFriendlyUrlNameAsync method. Because of this, a call loop was formed, we will fix this problem in the next release. Thanks for the bug report
8 months ago
Sergei-k wrote:
Yes, that's right, unfortunately in this method we missed the await instruction before calling the _affiliateService.ValidateFriendlyUrlNameAsync method. Because of this, a call loop was formed, we will fix this problem in the next release. Thanks for the bug report


Ok, thanks for the reply.
6 months ago
Sergei-k wrote:
Yes, that's right, unfortunately in this method we missed the await instruction before calling the _affiliateService.ValidateFriendlyUrlNameAsync method. Because of this, a call loop was formed, we will fix this problem in the next release. Thanks for the bug report


Checking to see if there has been an update to the web API yet and if so how i can access the new version of the web api plugin (mine came with the mobile app bundle).
6 months ago
twinvision wrote:
Checking to see if there has been an update to the web API yet and if so how i can access the new version of the web api plugin (mine came with the mobile app bundle).

No other updates have been made to the web API plugin yet
6 months ago
a.m. wrote:
Checking to see if there has been an update to the web API yet and if so how i can access the new version of the web api plugin (mine came with the mobile app bundle).
No other updates have been made to the web API plugin yet


Ok, thanks for the info.

Let me know if there is any ETA on fixing the Affiliates/ValidateFriendlyUrlName call as we are holding on some production clients until this is resolved, thanks!