The suggested fix works flawlessly.
Thank you.
Is it correct to say that you migrated this JsonConverter from NewtonSoft to System.Text.Json and removed the Newtonsoft version?
I did not expect that, because after following the initial github issue (https://github.com/abpframework/abp/issues/4337), the history for the implementation only shows two commits (and no deletes/renames/moves)
I will try out your solution to reimplement the original converter. Is this going to be patched into 4.4 or 5.0?
2021-09-09 15:04:07.490 +02:00 [ERR] Could not create an instance of type Volo.Abp.Validation.StringValues.IStringValueType. Type is an interface or abstract class and cannot be instantiated. Path 'groups[0].features[0].valueType.itemSource', line 1, position 297.
Newtonsoft.Json.JsonSerializationException: Could not create an instance of type Volo.Abp.Validation.StringValues.IStringValueType. Type is an interface or abstract class and cannot be instantiated. Path 'groups[0].features[0].valueType.itemSource', line 1, position 297.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Volo.Abp.Json.Newtonsoft.AbpNewtonsoftJsonSerializerProvider.Deserialize[T](String jsonString, Boolean camelCase)
at Volo.Abp.Json.AbpHybridJsonSerializer.Deserialize[T](String jsonString, Boolean camelCase)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor
1.GetResultAsync(Task task, Type resultType)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement.FeatureManagementModal.OnGetAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
2021-09-09 15:04:07.491 +02:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'.
2021-09-09 15:04:07.491 +02:00 [INF] Executed page /FeatureManagement/FeatureManagementModal in 34.2442ms
2021-09-09 15:04:07.491 +02:00 [INF] Executed endpoint '/FeatureManagement/FeatureManagementModal'
2021-09-09 15:04:07.491 +02:00 [INF] Request finished HTTP/2 GET https://localhost:44344/FeatureManagement/FeatureManagementModal?providerName=E&providerKey=c9fe2ebd-af65-ae47-a4e3-39fe74ffa094 - - - 500 132 application/json;+charset=utf-8 38.1383ms
I have tested this in a clean 4.4.0 and 4.4.2 template. The issue does not occur when i set UseHybridSerializer to true. I do not understand why this issue occurs. I have seen the JsonConverter written by maliming last year and it specifically is for Newtonsoft Json (which we still use). That code has not changed since then. What am I doing wrong.
Thank you for your reply.
After creating two seperate templates (4.3 and 4.4, just to be sure) which proved your point I went back to our application to try and locate the cause. I could not find any (relevant) differences between my application and the clean 4.4 app. Another clean and rebuild of our application 'fixed' this issue to my great annoyance. :-(
A clean and rebuild is normal operating procedure after any update (for ABP and every other third party addon)
So while this may have fixed the issue, it is not an explanation of the cause. And because it is now 'fixed', I cannot reproduce the error anymore...
2021-08-11 10:03:34.108 +02:00 [ERR] Could not found remote action for method: System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Kantan.FS.QuestionnairePreCheck.QuestionPreCheckDto]] GetListAsync(Kantan.FS.QuestionnairePreCheck.GetQuestionsPreCheckInput) on the URL: https://localhost:44316/
Volo.Abp.AbpException: Could not found remote action for method: System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Kantan.FS.QuestionnairePreCheck.QuestionPreCheckDto]] GetListAsync(Kantan.FS.QuestionnairePreCheck.GetQuestionsPreCheckInput) on the URL: https://localhost:44316/
at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(HttpClient client, String baseUrl, Type serviceType, MethodInfo method)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.MakeRequestAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.GetResultAsync(Task task, Type resultType)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at lambda_method2442(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
After upgradeing to ABP 4.4 a crud page returns the exception above
For this crud page there is a controller and an appservice. The appservice is hidden with the [RemoteService(IsEnabled = false)] attribute, which causes that the appservice is not visible for the outside world, the connection is made through the controller. However, in ABP 4.4 controllers are not found anymore on the host side (see the attached swagger screenshots of the host voor v4.3 and v4.4). This causes the exception.
We have several instances where we require a seperate controller and did not want both controller and appservice to be visible at the same time on the host. Following is some stripped code from v4.3 for the appservice and the controller. Is this method (using the remoteservice attribute) still supported? Why are controllers not visible anymore on the host side?
AppService:
[RemoteService(IsEnabled = false)]
public class QuestionPreCheckAppService : ApplicationService, IQuestionPreCheckAppService
{
public virtual async Task<PagedResultDto<QuestionPreCheckDto>> GetListAsync(GetQuestionsPreCheckInput input)
{
...
}
}
Controller:
[RemoteService]
[Area("fs")]
[ControllerName("QuestionPreCheck")]
[Route("api/fs/questionPreCheck")]
public class QuestionPreCheckController : AbpController, IQuestionPreCheckAppService
{
private readonly IQuestionPreCheckAppService _questionAppService;
public QuestionPreCheckController(IQuestionPreCheckAppService questionAppService)
{
_questionAppService = questionAppService;
}
[HttpGet]
[Route("GetList")]
public virtual Task<PagedResultDto<QuestionPreCheckDto>> GetListAsync(GetQuestionsPreCheckInput input)
{
return _questionAppService.GetListAsync(input);
}
}
ABP Framework version: v4.4.0
UI type:Blazor Server
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no
Exception message and stack trace:
2021-08-11 10:03:34.108 +02:00 [ERR] Could not found remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto
1[Kantan.FS.QuestionnairePreCheck.QuestionPreCheckDto]] GetListAsync(Kantan.FS.QuestionnairePreCheck.GetQuestionsPreCheckInput) on the URL: https://localhost:44316/
Volo.Abp.AbpException: Could not found remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto
1[Kantan.FS.QuestionnairePreCheck.QuestionPreCheckDto]] GetListAsync(Kantan.FS.QuestionnairePreCheck.GetQuestionsPreCheckInput) on the URL: https://localhost:44316/
at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(HttpClient client, String baseUrl, Type serviceType, MethodInfo method)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAsync(IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor
1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetResultAsync(Task task, Type resultType) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor
1.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at lambda_method2442(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Steps to reproduce the issue: Have a matching controller for an appservice and set the RemoteService(IsEnabled = false) attribute on the appservice
After upgradeing to ABP 4.4 a crud page returns the exception above
For this crud page there is a controller and an appservice. The appservice is hidden with the [RemoteService(IsEnabled = false)] attribute, which causes that the appservice is not visible for the outside world, the connection is made through the controller. However, in ABP 4.4 controllers are not found anymore on the host side (see the attached swagger screenshots of the host voor v4.3 and v4.4). This causes the exception.
We have several instances where we require a seperate controller and did not want both controller and appservice to be visible at the same time on the host. Following is some stripped code from v4.3 for the appservice and the controller. Is this method (using the remoteservice attribute) still supported? Why are controllers not visible anymore on the host side?
AppService:
[RemoteService(IsEnabled = false)] public class QuestionPreCheckAppService : ApplicationService, IQuestionPreCheckAppService { public virtual async Task<PagedResultDto
Controller:
[RemoteService] [Area("fs")] [ControllerName("QuestionPreCheck")] [Route("api/fs/questionPreCheck")] public class QuestionPreCheckController : AbpController, IQuestionPreCheckAppService { private readonly IQuestionPreCheckAppService _questionAppService;
public QuestionPreCheckController(IQuestionPreCheckAppService questionAppService)
{
_questionAppService = questionAppService;
}
[HttpGet]
[Route("GetList")]
public virtual Task<PagedResultDto<QuestionPreCheckDto>> GetListAsync(GetQuestionsPreCheckInput input)
{
return _questionAppService.GetListAsync(input);
}
}
I have successfully implemented this method.
I did however change one thing. We only want to remove the main jquery script from the global bundle to adjust it's position on the page. The other jquery scripts can remain in the global bundle at the bottom of the page.
public class RemoveJqueryScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.RemoveAll(x => x.StartsWith("/libs/jquery/jquery.js", StringComparison.InvariantCultureIgnoreCase));
}
}
I have also successfully tried the option ukocabicak mentioned. This is simpler in that it does not need to move the jquery script and uses an (to me) unknown method of kendo to adjust the timing of running the kendo controls, @Html.Kendo().DeferredScripts(); The 'downside' is that all controls need to call the .deferred() function.
Thank you both. I will also post both suggestions on the telerik support forums.
Thank you. I will try this out.
We are trying to use Telerik UI for ASP.Net Core within our abp.io web project (version 2.3 currently). This component pack requires jquery (version compatible with abp.io) and that the scripts are loaded before the components are used in a page.
ABP however loads all scripts at the bottom of the page. Because of that the telerik controls are not visible and we receive javascript errors.
As far as i know it is only possible to add scripts to the global bundle (but is rendered at the bottom of the page) or add new bundles/scripts per page (rendered where ever you want, but have to be on every page).
Two questions: