abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.87k stars 3.44k forks source link

Index was outside the bounds of the array #15590

Closed zengnanhua closed 1 year ago

zengnanhua commented 1 year ago

通过sql查询ExtraProperties里面的对象时,如果json字段太多(现在20个字段) 出现错误

maliming commented 1 year ago
zengnanhua commented 1 year ago

ABP Framework version: v5.20 UI type: Vue DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): yes Exception message and stack trace: Steps to reproduce the issue:" 1.通过对象在ExtraProperties中添加子对象 字段有点多 2.读出的时候就出现Index was outside the bounds of the array

maliming commented 1 year ago

Please share the full data, code and steps to reproduce.

zengnanhua commented 1 year ago

{"Hospitalization_number":"1726548","Sex":"\u7537","Age":"73\u5C81","Specimens":"\u90E8\u5206\u98DF\u7BA1\u53CA\u8FD1\u7AEF\u80C3","Location_of_primary_cancer_site":"\u98DF\u7BA1\u4E0B\u6BB5","Macroscopic_tumor_type":"\u6E83\u75A1\u578B","Histological_grade":null,"Pathological_diagnosis":"\u89D2\u5316\u578B\u9CDE\u72B6\u7EC6\u80DE\u764C","pT_stage":null,"pN_stage":null,"pM_stage":null,"Tumor_size_cm":"4","History_neoadjuvant_trtyn":null,"Radiation_therapy":null,"Weight":null,"DFS_months":null,"Ckpan":"\u002B","P63":"\u002B\u002B\u002B","CK5_6":"\u002B\u002B\u002B","P40":null,"Ki67":"0.1","CgA":null,"CD56":"-","CD34":"\u8840\u7BA1\u002B","P53":"\u002B","EGFR":"\u002B\u002B","VEGF":"-"}

zengnanhua commented 1 year ago

image

maliming commented 1 year ago

Exception message and stack trace

zengnanhua commented 1 year ago

{"error":{"code":null,"message":"Index was outside the bounds of the array.","details":"IndexOutOfRangeException: Index was outside the bounds of the array.\nSTACK TRACE: at System.Text.Json.JsonHelpers.TryParseDateTimeOffset(ReadOnlySpan1 source, DateTimeParseData& parseData)\n at System.Text.Json.JsonHelpers.TryParseAsISO(ReadOnlySpan1 source, DateTime& value)\n at System.Text.Json.JsonReaderHelper.TryGetEscapedDateTime(ReadOnlySpan1 source, DateTime& value)\n at System.Text.Json.Utf8JsonReader.TryGetDateTimeCore(DateTime& value)\n at System.Text.Json.Utf8JsonReader.TryGetDateTime(DateTime& value)\n at Volo.Abp.Json.SystemTextJson.JsonConverters.ObjectToInferredTypesConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)\n at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonDictionaryConverter3.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TDictionary& value)\n at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount)\n at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo jsonTypeInfo)\n at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)\n at Volo.Abp.EntityFrameworkCore.ValueConverters.ExtraPropertiesValueConverter.DeserializeObject(String extraPropertiesAsJson, Type entityType)\n at lambda_method1525(Closure , QueryContext , DbDataReader , ResultContext , SplitQueryResultCoordinator )\n at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.Enumerator.MoveNext()\n at System.Collections.Generic.List1..ctor(IEnumerable1 collection)\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\n at Fapon.Szbl.ClinicalService.PathologicalDatas.PathologicalDataAppService.GetListAsync(GetPathologicalDataListDto input) in /src/modules/clinical/src/Fapon.Szbl.ClinicalService.Application/PathologicalDatas/PathologicalDataAppService.cs:line 160\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync()\n at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed)\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync()\n at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed)\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync()\n at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed)\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync()\n at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)\n at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed)\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync()\n at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed)\n at Fapon.Szbl.ClinicalService.PathologicalDatas.PathologicalDataController.GetListAsync(GetPathologicalDataListDto input) in /src/modules/clinical/src/Fapon.Szbl.ClinicalService.HttpApi/PathologicalDatas/PathologicalDataController.cs:line 71\n at lambda_method1393(Closure , Object )\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n","data":{},"validationErrors":null}}

maliming commented 1 year ago

It works for me.

image
zengnanhua commented 1 year ago

单独我这边转化也没有问题用json query.toList()的时候就有问题

zengnanhua commented 1 year ago

image

zengnanhua commented 1 year ago

json 我挨个增加 到"P63":"\u002B\u002B\u002B" 就不行了 但是改一下值如 "P63":"\u002Bwww\u002Beee\u002B" 这样就可以了

zengnanhua commented 1 year ago

不知道为啥

zengnanhua commented 1 year ago

\u002B\u002B\u002B 这个会默认转化成时间吗

zengnanhua commented 1 year ago

\u002B\u002B\u002B this value convert time value?

maliming commented 1 year ago

This is not related to ABP but System text json.